Skip to content

Commit

Permalink
Use same locale name for logging and loading from file
Browse files Browse the repository at this point in the history
Signed-off-by: Nils Hanff <[email protected]>
  • Loading branch information
Nils Hanff committed Feb 7, 2024
1 parent 6988950 commit 4105b62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/language-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export class AppLocalization {

public fetchTranslationJson(locale: string): Record<string, string> | null {
try {
console.log("Fetching translation json for locale: " + locale);
return require(`./i18n/strings/${this.denormalize(locale)}.json`);
console.log(`Fetching translation json for locale: ${locale}`);
return require(`./i18n/strings/${locale}.json`);
} catch (e) {
console.log(`Could not fetch translation json for locale: '${locale}'`, e);
return null;
Expand All @@ -129,7 +129,7 @@ export class AppLocalization {
locales = [locales];
}

const loadedLocales = locales.flatMap(this.variations).filter((locale) => {
const loadedLocales = locales.flatMap(this.variations).map(this.denormalize).filter((locale) => {
const translations = this.fetchTranslationJson(locale);
if (translations !== null) {
counterpart.registerTranslations(locale, translations);
Expand Down

0 comments on commit 4105b62

Please sign in to comment.