Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android N multi-locale support not working as intended

While developing an app, I tried use Android N multi-lingual support. As explained on developers site. It seems that it will automatically pick the resources using resource resolution mechanism.

But it doesn't seem to be working or could it be that I am missing something?

Here is the complete scenario :

  1. Device as Portugese(pt_PT) and German(de_DE) as preferred language list respectively.
  2. Locales supported by app are placed in corresponding resource folder:

    a. values (default) b. values-de c. values-es

So according to explanation provided on developers site it should pick locale from "values-de" directory. But it shows the default one.

Could someone give me an idea of what might be going wrong??

enter image description here

like image 357
Sanjeet Avatar asked Sep 27 '16 04:09

Sanjeet


2 Answers

Ineteresting that this issue reproduces in sample project. But all works as intended if I remove "appcompat-v7" from compile dependencies. I don't know why for now and I'll keep digging.

UPDATE:

adding appcompact-v7 really fix the problem. watch this tutorial to understand why:

https://blog.egorand.me/a-curious-case-of-multiple-locales/

like image 124
Quickern Avatar answered Oct 22 '22 23:10

Quickern


I was facing this issue and found out that removing alternative resources the app does not need resolves the issue.

android {
  defaultConfig {
      ...
      // Keeps language resources for only the locales specified below.
      resConfigs "de", "es"
    }
}

Check out Google Developer documentation here

like image 31
Romina Liuzzi Avatar answered Oct 23 '22 00:10

Romina Liuzzi