feat: localize performance

This commit is contained in:
tresabhi committed 2025-01-07 12:47:55 -06:00
1 parent 7dfdf4c11b
commit 9de41529d1
15 files changed
+134 -76

No files matched your search

+34
View File
@@ -6,6 +6,16 @@
},
"common": {
"player_count_period": {
"total": "Total",
"d_120": "Past 120 days",
"d_90": "Past 90 days",
"d_60": "Past 60 days",
"d_30": "Past month",
"d_7": "Past week",
"d_1": "Yesterday"
},
"branches": {
"local": "dev",
"dev": "beta",
@@ -738,6 +748,30 @@
"body": "Estimated stats based on %s1 players. Updated %s2 ago.",
"hours": "%s1 hours",
"minutes": "%s1 minutes"
},
"player_count": {
"label": "Player count"
},
"table": {
"tanks": {
"header": "Tank",
"total": "Total"
},
"stats": {
"winrate": "Winrate",
"players": "Players",
"damage": "Damage",
"survival": "Survival",
"xp": "XP",
"kills": "Kills",
"spots": "Spots",
"accuracy": "Accuracy",
"shots": "Shots",
"hits": "Hits",
"damage_ratio": "Dmg. ratio",
"damage_taken": "Dmg. taken",
"capture_points": "Cap points"
}
}
},
"gallery": {
+6 -5
View File
@@ -1,11 +1,8 @@
import { merge } from 'lodash-es';
import type en from '../../lang/en.json';
import { assertSecret, DEFAULT_LOCALE, SUPPORTED_LOCALES } from '../blitzkit';
import { DEFAULT_LOCALE, SUPPORTED_LOCALES } from '../blitzkit';
import { TranslationTree } from './translator';
const PUBLIC_DEBUG_MISSING_I18N = assertSecret(
import.meta.env.PUBLIC_DEBUG_MISSING_I18N,
);
const files = import.meta.glob('../../lang/*.json', { eager: true });
export const localizedStrings: Record<string, typeof en> = {};
@@ -25,7 +22,11 @@ SUPPORTED_LOCALES.forEach((locale) => {
const strings = files[`../../lang/${locale}.json`];
const mergedStrings = merge({}, defaultStrings, strings);
if (PUBLIC_DEBUG_MISSING_I18N === 'true') nuke(mergedStrings);
/**
* For some reason, this won't load on the server on the first render so I am
* not asserting this one lol
*/
if (import.meta.env.PUBLIC_DEBUG_MISSING_I18N === 'true') nuke(mergedStrings);
localizedStrings[locale] = mergedStrings as typeof en;
});