I've simple translation keys like login-page.login
.
When building in AOT, the translation isn't displayed correctly and instead the key fr.login-page.login
is displayed.
I didn't found why AOT would add the lang prefix.
Obviously in JIT everything working beautifully. And in both mode (AOT and JIT) I can see translation filesbeing loaded FYI, I'v a translation file per components and each file is scoped in the component provider. Here is my transloco config:
provideTranslocoConfig({
availableLangs: ['en', 'fr'],
reRenderOnLangChange: true,
defaultLang: 'fr',
fallbackLang: 'en',
missingHandler: {
useFallbackTranslation: true,
logMissingKey: false,
},
prodMode: environment.production,
flatten: {
aot: environment.production,
},
}),
EDIT
I checked at runtime, I've:
this.translocoService.availableLangs
-> []
While:
this.translocoService.lang.getValue()
-> "fr"
When I check this.translocoService.translations
, I've all my "fr" translation.
Lastly, if I try this.translocoService.translate('login-page.login')
, it's logging as error Missing translation for 'fr.login-page.login'
.
EDIT When I start the project in JIT the translocoService.config give back the config I set. But when I turn on the AOT the translocoService.config is just full of default configs all project config disappeared...