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

На некоторых устройствах в некоторых местах текст не меняется #11

Open
TikTak123 opened this issue Dec 10, 2019 · 3 comments

Comments

@TikTak123
Copy link

Здравствуйте
Я использую вашу библиотеку в своем приложении, но на некоторых устройствах в некоторых местах текст не меняется. В этих устройствах всё хорошо работает, если полностью закрою приложение и заново в него войду. У себя в проекте я использую библиотеку Conductor вместо фрагментов. Мы про тестировали это на нескольких устройствах. Могу скинуть скриншоты и марку телефонов на которых оно проявляется.

Код Application класса как я инициализироваю Lingver:

@Override
    public void onCreate() {
        super.onCreate();
        Lingver.init(this, new PreferencesHelper(this, new Gson()).getLocale()); 
}

Это код после смены языка пользователем:

@Override
    public void changeLanguage(@NotNull String lang) {
        Lingver.getInstance().setLocale(binding.getRoot().getContext(), lang);
        getActivity().recreate();
    }
@YarikSOffice
Copy link
Owner

YarikSOffice commented Dec 11, 2019

Hi @TikTak123
I'll answer in English, so other developers could also read if they face the same issue.

Question in short:
The content is not translated in some places after applying a new language/locale.

Answer:
According to your code, you are recreating the top activity only. Do you follow the single activity approach? In case you are using multiple activities, you have to recreate a whole activity back stack.

Moreover, you are responsible for re-fetching of all strings that were fetched before applying a new locale. Therefore, make sure your strings are not cached somewhere by you or Conductor framework.

@TikTak123
Copy link
Author

I have only one activity in the application. The place where the text is not translated, it takes this text from the string.xml file. I will try to analyze my application.

@YarikSOffice
Copy link
Owner

There is a critical bug in version 1.2.0. According to my tests, it happens while setting a locale with a country qualifier ( e.g. en_US) on Android API 24 and above.

Kindly update the library and let me know if it's fixed for you.

Also, the latest version addresses the well-known bug with WebView related to locales. Kindly check the documentation for more info as well as the sample project for an example of implementation.

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