In app.module.ts has the following provider:
{
provide: LOCALE_ID,
useFactory: (translate: TranslateService) => translate.currentLang,
deps: [TranslateService]
}
I have updated angular version from 8.2 (iteratively to 12). Everything worked on version 8.2, but now undefined is always written to LOCALE_ID.
But if I change the code to:
{
provide: LOCALE_ID,
useValue: 'en'
}
Then everything works, from here I conclude that the problem in useFactory, but there are no ideas how to fix it.
Additionally, if it is important:
- I am using ngx-translate 13.0.0
- In services and pipes, I get the parameter as follows:
constructor(@Inject(LOCALE_ID) private locale: string)
- Also TranslateService is undefined in the AppModule class, although in other places of the application, after loading it is available
SOLVED: The question was solved, the transfer of the provider from app.module to app.component helped