In my app users have the ability to switch their app locale to one of the other app supported languages. I'm having issues getting Portuguese-Brazil and Simplified Chinese to work. All other translations work properly when the user changes the locale settings.
These translations work properly if the device locale is pt-rBR or zh-rCN so the only thing that could be wrong is the locale code I use. However, anything I've tried fails. Anybody know the proper Android locale codes for these so users can properly switch if they desire?
The default Locale is constructed statically at runtime for your application process from the system property settings, so it will represent the Locale selected on that device when the application was launched.
Locale represents a language/country/variant combination.
Locales are used on Android to tailor the app to that specific region. Not only is it used for language selection but also other region-specific things like currency, temperature, date formatting, et cetera.
Use
new Locale("pt","BR");
instead of
new Locale("pt_BR");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With