0

I am facing the issue on language change option inside the app.

I have implemented 2 languages on my app 1) English and 2) Hebrew Based on the selection, I am trying to convert the app language but somehow its stop working.

Below is the code of language what I am using.

public void changelanguage(String languageToLoad, Context context) {

        Locale locale = new Locale(languageToLoad);
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        context.getResources().updateConfiguration(config,
                context.getResources().getDisplayMetrics());

    }

and for hebrew language I am using "iw" word for comparison.

Below is the log of logcat:

07-30 20:12:26.146 23878-26997/paycalldailer.paycall.co.il V/FA: Inactivity, disconnecting from the service 07-30 20:12:30.330 23878-23878/paycalldailer.paycall.co.il I/System.out: Language Flag GC::1 07-30 20:12:30.341 23878-23878/paycalldailer.paycall.co.il I/System.out: Cursor::android.content.ContentResolver$CursorWrapperInner@3acb7a4 07-30 20:12:30.341 23878-23878/paycalldailer.paycall.co.il I/System.out: This is if 07-30 20:12:30.363 23878-23878/paycalldailer.paycall.co.il I/System.out: Change Langa : עברית 07-30 20:12:30.412 23878-26997/paycalldailer.paycall.co.il V/FA: Recording user engagement, ms: 9327 07-30 20:12:30.413 23878-26997/paycalldailer.paycall.co.il V/FA: Using measurement service 07-30 20:12:30.413 23878-26997/paycalldailer.paycall.co.il V/FA: Connecting to remote service 07-30 20:12:30.417 23878-26997/paycalldailer.paycall.co.il V/FA: Activity paused, time: 38061307 07-30 20:12:30.423 23878-26997/paycalldailer.paycall.co.il D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=9327, firebase_screen_class(_sc)=ChangeLanguage, firebase_screen_id(_si)=-841994326498933721}] 07-30 20:12:30.440 23878-26997/paycalldailer.paycall.co.il V/FA: Using measurement service 07-30 20:12:30.440 23878-26997/paycalldailer.paycall.co.il V/FA: Connection attempt already in progress 07-30 20:12:30.489 23878-23878/paycalldailer.paycall.co.il V/FA: onActivityCreated 07-30 20:12:30.529 23878-23878/paycalldailer.paycall.co.il I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.

Please suggest me where I am wrong. Its suddenly stop working.

Himadri
  • 187
  • 2
  • 3
  • 13

1 Answers1

0

Are you using any webview in your App ? Because there is a known issue due to using webview that reset local language to your default language.

cf. Android Nougat 7.1 resets Locale after launching WebView

  • Yes I am using the webview in my app but it is working fine before few days suddenly its stopped working without doing any change on code and now it is not working below 7.0 version also. Actually the language change is working fine but it will not reflect on UI – Himadri Jul 31 '18 at 05:23
  • I had the same problem, when I instantiate my webview the local language previously set is going back to default language. I didn't notice it at first, but I am pretty sure it is related to your problem. The solution is to reset language after webview initialization. Trust me, it took me weeks to understand where this problem came from and I still don't understand why it exists ... – Vincent Chann Jul 31 '18 at 12:01