Chore: Fix pseudo translations (#102295)

* remove unnecessary pseudo translations

* properly initialise pseudo translations in core (not grafana-ui)
This commit is contained in:
Ashley Harrison
2025-03-17 16:45:36 +00:00
committed by GitHub
parent 3bdb2aa349
commit 2ece94bc50
3 changed files with 17 additions and 3736 deletions

View File

@ -20,23 +20,6 @@ function initI18n() {
resources: {},
returnEmptyString: false,
lng: 'en-US', // this should be the locale of the phrases in our source JSX
postProcess: [
// Add pseudo processing even if we aren't necessarily going to use it
'pseudo',
],
});
}
if (process.env.NODE_ENV === 'development') {
import('i18next-pseudo').then((module) => {
const Pseudo = module.default;
i18next.use(
new Pseudo({
languageToPseudo: 'pseudo',
enabled: true,
wrapped: true,
})
);
});
}
}

View File

@ -27,6 +27,10 @@ export async function initializeI18n(language: string): Promise<{ language: stri
fallbackLng: DEFAULT_LANGUAGE,
ns: NAMESPACES,
postProcess: [
// Add pseudo processing even if we aren't necessarily going to use it
'pseudo',
],
};
i18nInstance = i18n;
@ -38,12 +42,20 @@ export async function initializeI18n(language: string): Promise<{ language: stri
options.lng = VALID_LANGUAGES.includes(language) ? language : undefined;
}
const loadPromise = i18nInstance
.use(loadTranslations)
.use(initReactI18next) // passes i18n down to react-i18next
.init(options);
i18nInstance.use(loadTranslations).use(initReactI18next); // passes i18n down to react-i18next
await loadPromise;
if (process.env.NODE_ENV === 'development') {
const { default: Pseudo } = await import('i18next-pseudo');
i18nInstance.use(
new Pseudo({
languageToPseudo: 'pseudo',
enabled: true,
wrapped: true,
})
);
}
await i18nInstance.init(options);
tFunc = i18n.getFixedT(null, NAMESPACES);

File diff suppressed because it is too large Load Diff