Skip to content
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

android overrideLocale won't restart app #96

Open
wyong95 opened this issue Jul 20, 2020 · 1 comment
Open

android overrideLocale won't restart app #96

wyong95 opened this issue Jul 20, 2020 · 1 comment

Comments

@wyong95
Copy link

wyong95 commented Jul 20, 2020

image

The doc stated switch language require to restart the app but _android.foregroundActivity.finish(); just close the app and not restarting the app. How to make it restart the app and change to the language I selected ? After I open back the app again, the language didn't change at all, still default device's language.

I want to change from chinese to english or vice-versa and able to restart the app after changing the language and display the content with the language selected.

Another question, will it be showing english after I change from chinese if I kill the app and reopen again?

P/S: My default device's language is zh-CN.

Nativescript 6.7.8
Angular 8.2.0
tns-android 6.5.0

@atifmerghad
Copy link

atifmerghad commented Aug 3, 2020

Try to call :
In main.ts file :
on(launchEvent, (args) => { if (args.android) { androidLaunchEventLocalizationHandler(); } });

In your function to change language programmatically (ts file. example : example.component.ts) :

changeLanguage(lang){
const localeOverriddenSuccessfully = overrideLocale(lang);
    if (!isIOS) {
      androidLaunchEventLocalizationHandler();
    } else {

    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants