Skip to content

Commit 92c1ff2

Browse files
committed
country code
1 parent 95da760 commit 92c1ff2

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

LongevityWorldCup.Website/wwwroot/onboarding/pheno-age.html

+10-8
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,10 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">The Blood Pact
386386
// Setting up the animated counter effect
387387
let displayAge = 0;
388388
resultElement.innerHTML = `
389-
<div style="font-size: 1rem; color: #2c3e50; text-align: center;">Your biological age is:</div>
390-
<div style="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center;"><span id="animatedAge">0</span></div>
391-
<div id="yearsText" style="font-size: 1rem; color: #2c3e50; text-align: center;">years</div>
392-
`;
389+
<div style="font-size: 1rem; color: #2c3e50; text-align: center;">Your biological age is:</div>
390+
<div style="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center;"><span id="animatedAge">0</span></div>
391+
<div id="yearsText" style="font-size: 1rem; color: #2c3e50; text-align: center;">years</div>
392+
`;
393393

394394
if (isFirstTimeAnimation) {
395395
// Set the flag to false after the first run
@@ -443,7 +443,7 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">The Blood Pact
443443
apUnit: '1', // U/L
444444
wbcUnit: '1' // 1000 cells/μL
445445
},
446-
en_GB: {
446+
GB: {
447447
albuminUnit: '1', // g/L (SI unit, common in the UK)
448448
creatinineUnit: '1', // µmol/L
449449
glucoseUnit: '1', // mmol/L
@@ -514,9 +514,11 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">The Blood Pact
514514

515515
// Detect and apply preferences based on language
516516
function applyLanguagePreferences() {
517-
const language = navigator.language || 'default'; // Get browser language
518-
const languageKey = language.replace('-', '_'); // Replace dash with underscore
519-
const preferences = unitPreferences[languageKey] || unitPreferences.default;
517+
const language = navigator.language || 'default'; // e.g., 'en-US'
518+
const countryMatch = language.match(/[-_](\w{2})$/); // Extract country code)
519+
const countryCode = countryMatch ? countryMatch[1].toUpperCase() : '';
520+
521+
const preferences = unitPreferences[countryCode] || unitPreferences.default;
520522

521523
// Apply preferences to unit select elements
522524
for (const [unitId, unitValue] of Object.entries(preferences)) {

0 commit comments

Comments
 (0)