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 21, 2024
1 parent 7c71ac1 commit 2ca86f7
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 @@ -115,8 +115,8 @@ export class AppLocalization {

public fetchTranslationJson(locale: string): Record<string, string> | null {
try {
console.log("Fetching translation json for locale: " + locale);
return loadJsonFile(__dirname, "i18n", "strings", `${this.denormalize(locale)}.json`);
console.log(`Fetching translation json for locale: ${locale}`);
return loadJsonFile(__dirname, "i18n", "strings", `${locale}.json`);
} catch (e) {
console.log(`Could not fetch translation json for locale: '${locale}'`, e);
return null;
Expand All @@ -130,7 +130,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 2ca86f7

Please sign in to comment.