Skip to content

Commit

Permalink
with some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
thisconnect committed Nov 15, 2024
1 parent 542df0b commit d49b395
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frontends/web/src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const loadLanguage = async (language: string) => {
};

export const changei18nLanguage = async (language: string) => {
console.log('changei18nLanguage', language);
await loadLanguage(language);
await i18n.changeLanguage(language);
};
Expand Down Expand Up @@ -95,6 +96,7 @@ i18Init.init({
// loadLanguage(defaultLang);

i18n.on('languageChanged', async (lng) => {
console.log('langauge changed', isChangingLanguage);
// changei18nLanguage triggers languageChanged, thus this check to prevent loop
if (isChangingLanguage) {
return;
Expand All @@ -111,6 +113,7 @@ i18n.on('languageChanged', async (lng) => {
// setting it to null here in JS turns it into an empty string "" in Go backend.
// This is ok since we're just checking for a truthy value in the language detector.
const nativeLocale = await getNativeLocale();
console.log('nativeLocale', nativeLocale);
let match = lng === nativeLocale;

if (!match) {
Expand Down

0 comments on commit d49b395

Please sign in to comment.