lingver
lingver copied to clipboard
Part of the UI is not loading the correct language
I have a BaseActivity which Extends AppCompatActivity.
public class BaseActivity extends AppCompatActivity {
private final String TAG = "BaseActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Log.e(TAG, "LANGUAGE : " + C.CurrentLanguage);
}
@Override
public void applyOverrideConfiguration(Configuration overrideConfiguration) {
if (overrideConfiguration != null) {
int uiMode = overrideConfiguration.uiMode;
overrideConfiguration.setTo(getBaseContext().getResources().getConfiguration());
overrideConfiguration.uiMode = uiMode;
}
super.applyOverrideConfiguration(overrideConfiguration);
}
}
After Changing the Language it look like this.
I have checked for missing translations. But all the strings are there . But not loading some of the strings. How to solve this issue
I have same problem
Guys, could anyone create a small sample project that can reproduce the issue? since I can't replicate it on my side. I've been using this approach (not the library) for years and have never faced this issue.
I made this project using fragments. https://github.com/TikTak123/LanguageFragmentExample
I made this project using Conductor. https://github.com/TikTak123/LanguageConductorExample
Both have the same problem. Here is the video that plays the bug. https://drive.google.com/file/d/1xU90veGEjSpQb-AEg9cFkk7Bhxnt6Nwn/view?usp=sharing
Steps to reproduce the bug:
- Change the language to Ukrainian.
- Open another window.
- Go back.
@TikTak123 thanks for the sample project! Finally, I can reproduce it.
Looks like a web view resets the locale to the device default. There is another issue submitted today reporting the same behavior.
I'll investigate that soon and check what I can do. Stay tuned.
@nuwanchamara Have you solved the problem with changing the language? I also have this problem even without WebView. This bug works after changing the language and it does not always work, and not everywhere and not on all devices. I can’t reproduce it in the sample project. Other than that, I'm not sure if this is the case with the Lingver library, since I use the Conductor library instead of fragments. Can you write a sample project where this bug is reproduced in your case?
As my case, I still have not found the answer. Here are my other language change questions: https://github.com/YarikSOffice/lingver/issues/11 https://github.com/bluelinelabs/Conductor/issues/579 https://github.com/bluelinelabs/Conductor/issues/580
Hi, I was also having this issue and i fixed it by this code. I don`t know if this is good way of doing it or not but it worked for me. override fun onDestroy() { super.onDestroy() context?.let { Lingver.getInstance().setLocale(it, getLocale()) } // get actual selected locale here webView.destroy() }
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.
This is didn't help me, but in my app I fixed this issue like this:
@Override
protected void onContextAvailable(@NonNull Context context) {
super.onContextAvailable(context);
Lingver.getInstance().setLocale(context, Lingver.getInstance().getLocale());
}
Every time when Controller created it calls onContextAvailable method where I set locale again.
@YarikSOffice I have the same problem and after update the library to latest version (1.2.1), My problem was not solved. I use this lib in the android project.
what can i do?
@rexi1r could you describe your issue in more details? a sample project reproducing the issue will be highly appreciated since I've been not able to identify it for a long time already.
@YarikSOffice yeh, This problem often occurs at the first application opening. you can see the tab's name is correct language but the content of tab that is inside a fragment, it's not correct,
I will try to create a sample application but, our problem occurs on our situation, so it's better to solve this problem for all.
@rexi1r a sample project will significantly help fixing this issue for everyone. Thanks in advance!