# Problems having an app change its locale



## SkullOne (Jul 9, 2011)

In my app users have the ability to switch their app locale to one of the other app supported languages. However, I'm having issues getting Portuguese-Brazil and Simplified Chinese to work. All other translations work properly when the user changes the apps locale.

The folders for the string values are:
values-pt-rBR
values-zh-rCN

That means the locale codes *should* be pt-rBR and zh-rCN. However, those don't work.

These translations work properly on devices that use them, so the only thing that could be wrong is the locale code I use to select. However, everything I've tried fails. Am I missing something here?

I could simply drop them into values-pt and values-zh and they'll work, but that defeats the purpose of having different versions of the language. I know that values-zh is typically traditional Chinese so I'd prefer to not put the Simplified Chinese in that folder and make it seem like the app supports a language is actually doesn't.

Many thanks!


----------



## JBirdVegas (Jun 11, 2011)

Hate to say it but this maybe better answered on StackOverflow... All I can do is point you to the default localization android dev page :-(


----------



## SkullOne (Jul 9, 2011)

JBirdVegas said:


> Hate to say it but this maybe better answered on StackOverflow... All I can do is point you to the default localization android dev page :-(


Did that yesterday lol. No responses yet.

I also asked in #android-dev and got nothing. I'll ask on IRC again though when I can.

Thanks!

Sent from my Galaxy Nexus using Tapatalk 2


----------



## JBirdVegas (Jun 11, 2011)

Would you mind linking us to those posts? Who knows it may get answered on another resource and I may one day have the same issue. I am curious about this because I've never had a chance to work much with other languages, sadly.


----------



## SkullOne (Jul 9, 2011)

JBirdVegas said:


> Would you mind linking us to those posts? Who knows it may get answered on another resource and I may one day have the same issue. I am curious about this because I've never had a chance to work much with other languages, sadly.


Sure.

http://stackoverflow.com/questions/15616683/what-is-the-proper-locale-code-for-android-for-simplified-chinese-and-portugese

Hopefully, somebody can answer it. For now I'm just omitting the ability to change to Simplified Chinese or Portuguese. Better to release and add more later than not release any all in this case.


----------



## JBirdVegas (Jun 11, 2011)

Release early and release often FYI CommonsWare is an extremely knowledgeable and nice guy. He is also a very well known author on lots of Android development book. I'm using a couple of his libraries in my apps as he writes extremely good code. If he can give you a response probably correct.


----------



## SkullOne (Jul 9, 2011)

JBirdVegas said:


> Release early and release often FYI CommonsWare is an extremely knowledgeable and nice guy. He is also a very well known author on lots of Android development book. I'm using a couple of his libraries in my apps as he writes extremely good code. If he can give you a response probably correct.


Good to know. He responded very quickly and what he said is definitely correct. Just not the answer I need lol. Will certainly keep an eye out for his responses in the future.

Sent from my Galaxy Nexus using Tapatalk 2


----------



## SkullOne (Jul 9, 2011)

The gentleman, who has been constantly updating my Chinese translation for me, pushed this code to my app which corrects the issues with Portuguese-Brazil and Simplified Chinese locale codes.

So many thanks to Tommy (iptux). I figured I'd post it here for anybody who needed to know since this should work for just about any language and app.

https://github.com/s.../Api.java#L1119

https://github.com/s...s/array.xml#L28

https://github.com/s...ivity.java#L138


----------

