0

I have an old android application I inherited. It has strings files in multiple locales (e.g., es, fr, pt). I'm pretty sure localization used to work .. or still works?

Here's what I did:

  • run an android emulator (the "qemu-system-i386" with Orange Rise 32 API version 23, which is android 6.0, to test older hardware)
  • run the app in Android Studio and it gets deployed to the emulator
  • set the locale. I tried 1) using the "Settings" in the emulator, 2) Tried through adb shell as documented here.

It looks to me like the localization settings are changed in the emulator. All the controls and menus for the system are in Spanish, for example.

When I look at the app, it's all still default resources. I can stop and restart the app in Android Studio, and it's still all default resources. I added a "current_locale" string in each strings file ("default" in default, "es" in the es version, etc.), and display it. It shows "default".

I can't get the locale from Java, since that requires minSdkVersion 28, and I'm trying to support back to version 14.

Nothing useful in the logcat window.

How can I tell what's going on?

I guess I could deploy it to a phone somehow and see if it works there.

dfrankow
  • 20,191
  • 41
  • 152
  • 214
  • Maybe try to recreate string files. They could be created in the wrong way or not compatible if there were any changes lately. Follow this documentation: https://developer.android.com/guide/topics/resources/localization#creating-alternatives Also, there is a bug with WebViews I had in my app. If your app is using WebView somehow it just resets your locale to default after WebView is used. I don't know if this got fixed but I ran into this problem earlier this year and read it was really a bug a lot of people had. – SlothCoding Jan 03 '21 at 00:37
  • Thank you! I think https://stackoverflow.com/a/40675539 is describing this. I will try it. – dfrankow Jan 03 '21 at 04:23
  • I (re?)-discovered that this app has a "Settings" screen that allows you to override the language. So it was internal. However, your comment helped me find that, so thank you! – dfrankow Jan 03 '21 at 04:51
  • You are welcome, I am glad to help. – SlothCoding Jan 03 '21 at 10:39

0 Answers0