-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nativescript/Angular - Localize-function does not apply the new localizations after overridelocale #98
Comments
I have been debugging this and I have realised this issue occurs when the localize-functions are called before the androidLaunchEventLocalizationHandler(); is complete. I have content that is localized on app start-up using the localize()-function. Is there a hook to attach this function somewhere where it will ran before the rest of the application is loaded? Anyone has a workaround for this kind of situations? |
Okay, so for anyone else running into same issues. I noticed that the launch-event that the documentation tells to hook the androidLaunchEventHandler-is triggered much later that for example AppComponent constructor. What I did I ran the androidLaunchEventHandler-function on AppComponent constructor. That solves the issue that I described earlier. What was weird is that with this function call only in AppComponent, the translations using the L-pipe on templates did not work anymore. Then I added the function call also the main.ts and I got also those working. ' So now I am calling this function twice to make everything work correctly. Not sure if this results in some other errors or if this is very bad for performance. Any ideas anyone? |
Thank you for hint with this calling in app component, saved my day! |
Well in the end, i moved on something else what is working on website too. |
@PavelSuk98 ngx-translate works on native script angular? I am also facing same issue , language change not working on android, ios its working fine |
Yers it is working on android and i would say it will work on IOS too that ngx-translate |
For me, it was enough to place |
As @ReazerDev has said, for me it was exactly the same. Remove |
Same issue here, I've tried few option state here but in UPDATE: It actually works in app.component.ts constructor but the devil is in the detail as the documentation suggest this:
And that doesn't work, what works for me as much simpler:
And that's all, no need duplication in main.ts etc... |
I am running into issues with the overridelocale-method.
After overriding the locale and restarting the application, the localizations done on the template with {{'Localizationstring: L}} seem to be correctly updated but all the content I have added using the localize()-function on the TypeScript are not updated and continue showing the default localization.
The text was updated successfully, but these errors were encountered: