YarikSOffice / lingver

Manage your application locale and language.
https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758
MIT License
508 stars 62 forks source link

Not possible to change "Cyrillic" to "Latin". #54

Open menscikov opened 6 months ago

menscikov commented 6 months ago

Hello,

I have Serbian language in the app. It can be "Latin" or "Cyrillic". It's not possible to change this using this library.

For example to change letters to "Latin", you have to do this: Lingver.getInstance().setLocale(context, new Locale.Builder().setLanguage("sr").setScript("Latn").build());

But it's not working as expected. In this case this code is resetting the app language to default system language, English in my case.

This one is working fine when ".setScript("Latn")" is not being used: Lingver.getInstance().setLocale(context, new Locale.Builder().setLanguage("sr").build());

Could you fix this bug please?

menscikov commented 5 months ago

Hello, this project is not supported anymore?

YarikSOffice commented 5 months ago

Hey @menscikov! Thanks for submitting this issue and for your interest in the project

The project is live, but I'm unable to look deeply into this issue due to a lack of free time in the next week or two.

Have you been able to find out the root cause of the issue? I'd appreciate any contribution to the library.

So far I have 2 points here:

  1. The library doesn't save/restore setScript property for the process restarted scenario. We have to either add it to the library or you can override LocaleStore and pass it to the initialization function. However, this might not be your only issue since it doesn't explain why your locale is reset to the default.
  2. Are you sure your locale folder contains translations for the Latn variant?
menscikov commented 5 months ago

Helllo,

Thank you very much for your answer. I have sr language in my translations.

Could you please try to create sr language and check this? The problem is also in Lingver.getInstance().setFollowSystemLocale(). If i set Serbian language in my mobile device, then it's not selecting automatically in my app. For other languages it works.