0

I am trying to change the android Locale

Some of the solutions such as Android-Localization are working but only at the beginning. After couple of hours in the background some of the items are changing to default

At first (good):

good EditText and toolbar

After couple of hours in the background (not good):

Note: Not all is changing! Some still using the correct strings, system still in RTL etc. But, toolbar, drawer, bottom Edit text not good (even if initiated in the onCreate as suggested in the documentation)

Not good EditText and toolbar

As my last attempt using Android-Localization

//Gradle
implementation 'com.akexorcist:localization:1.2.4' 

//App
public class App extends LocalizationApplication {

//..

@NotNull
    @Override
    public Locale getDefaultLanguage() {
        return new Locale( "iw");
    }

}

//Every activity
public class MainActivity extends LocalizationActivity {
//..
}

I also checked answers such as

change app language programmatically in android

android how can i select a strings xml without localization

BTW - I could see notes saying it is not recommended to change the locale and instead let android system select it, but this is none-sense. A lot of apps are doing it including Whatsapp, Facebook, netflix... Why oh why google always making everything so complicated??

epic
  • 1,333
  • 1
  • 13
  • 27
  • `onResume()` also you have to setLocale – Nensi Kasundra Apr 09 '20 at 08:45
  • When extending the `LocalizationActivity` it already handles that. I also tried to use other manual solutions and re-activated in the `onResume` but also did not help. – epic Apr 09 '20 at 09:09
  • 1
    Please use android locale only check this https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758 – Nensi Kasundra Apr 09 '20 at 09:14
  • I could not get it to work. Did you use it? Did you tested it on android 9? is there any proven source code without any issues? Android will make me crazy, there is nothing simple with what they do. – epic Apr 09 '20 at 15:30
  • please check this one https://www.tutorialspoint.com/how-to-change-the-app-language-programmatically-in-android – Nensi Kasundra Apr 10 '20 at 04:54
  • this one also https://www.androidhive.info/2014/07/android-building-multi-language-supported-app/ – Nensi Kasundra Apr 10 '20 at 04:57
  • Thank you for trying to help. I checked many tutorials and i believe i at least understand the problem. The fact that the locale is taken directly from context and there are 3 types of context, not to mention the strings such as activity names taken directly from such as Manifest poses great complexity. I can overcome locale parameters taken from manifest (by re-insert in `onCreate`) and from activity context (by `recreate()`) but it seems i cannot if taken or refreshed from `Application`. Am i wrong? if not, question: for what is the `Application` locale parameter important for, if at all? – epic Apr 10 '20 at 07:32

0 Answers0