refactor TranslationApi implementations to initialize immediately + own language listener

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-16 12:02:36 +02:00
parent cc8b053547
commit 7b3a58f0b6
2 changed files with 17 additions and 10 deletions
@@ -41,9 +41,15 @@ export class MockTranslationApi implements TranslationApi {
ns: [],
defaultNS: false,
fallbackNS: false,
// Disable resource loading on init, meaning i18n will be ready to use immediately
initImmediate: false,
});
i18n.init();
if (!i18n.isInitialized) {
throw new Error('i18next was unexpectedly not initialized');
}
return new MockTranslationApi(i18n);
}