App i am working on supports Indonesian locale, I do have
"values-in"
"values-in-rID"
resource folders.Both contains strings only.
I didn't find any info regarding "values-in-rID". i can see its getting used here too in android sdk
values-in means Indonesian Locale, and in all regions.
values-in-rID means Indonesian Locale, but applies only in the region of Indonesia. The r here means region.
The following screenshot should make things clear.
These are language and locale codes. For example, French in France is not entirely the same as French in Canada, so you might see fr-FR and fr-CA used to differentiate them instead of just using fr.
Android has a resource fallback mechanism that uses this folder naming pattern. Imagine your app has language resources for French(France) in a folder values-fr-rFR, resources for French(Switzerland) in a folder values-fr-rCH and resources that are the same for France and Switzerland in a folder values-fr. For the app locale French(Switzerland) Android will first attempt to load resources from the values-fr-rCH folder and then fall back to values-fr. See here for further details.
So, the folder values-in-rID contains resources for usage in Indonesian as spoken/written in Indonesia. Whether this approach makes sense for Indonesian or not I don't know: it certainly does if a variant of Indonesian is used outside of Indonesia. Anyway, make sure to provide a set of default resources as well as your Indonesian resources, as described here.
Related
I'm working on localizing an Android app.
For arguments sake, let's say the app will support English, Albanian, and Bengali.
Currently all English strings are listed in the "default value" column of the translations editor:
Apps on the app store generally state what locales they support.
I'm assuming when you submit an app that either a person or machine verifies your claims... so...
Is it necessary to explicitly add English (en) locale/column in addition to the default values (just as Albanian and Bengali have been added in the photo) in order for the app to be considered to officially "support" English?
You do not have to add English locale to have it in Supported Language menu. Check documentations out.
When your Java code refers to strings, the system would load strings from the default (en_US) resource file, even if the app has Spanish resources localized under es_ES. This is because when the system cannot find an exact match, it continues to look for resources by stripping the country code off the locale. Finally, if no match is found, the system falls back to the default, which is en_US.
The system would also default to en_US if the user chose a language that the app didn't support at all, like French.
Default locale is en_US.
No.
Apps on the app store generally state what locales they support.
If you are talking about Apple's App Store, Google Play won't list the supported languages in similar fashion.
However, you can localize the store listing page. According to play console help, If a user's language preference matches the translation languages you've added, they'll see your app's translated version. You can also add localized graphic assets for your store listing pages. See this for more. This feature is similar to App Store's metadata localization.
There is an easy solution to your problem.
Just find the path in your project:
res/
and add a folder named:
values-en
Then add a file named:
strings.xml
Finally, it will look like this:
res/values-en/strings.xml
And the resources in it will show when the user's language setting is English.
I have an image in folder drawable-en-rCA. I do not have any folder like drawable-en-rIN, or drawable-in. When I change my app locale to en_IN, drawable is picked-up from drawable-en-rCA whereas it is expected to take from default drawable folder as there are no drawables present specific for en_IN.
Can somebody help me to understand why this is happening?
If you are experiencing this issue on device running Android N or above, I think your issue might be related to the findings mentioned on this answer: Localization for Canada defaults to UK; should default to US. Google released a documentation on the Improvements to Resource-Resolution Strategy post Android N. There was also a bug report Incorrect resource resolution strategy above Android N, defaulting to en_GB and not default strings.xml for the issue but it turns out it is not a bug but a feature. Here is their response:
Starting in Android N, all English locales (except for US and US territories like Puerto Rico and American Samoa) fall back to some International English variant if such a locale is available.
So for en-CA, we would try these locales first, before falling back on en-GB (which is considered a representative of International English if there is no better International English locale): en-rCA (Canadian English), b+en+001 (International English), en (English). If you don't want en-GB strings to be picked up for en-CA, you should put resources in one of those three directories, as they would be considered a better match for en-CA.
For your case, based on these (specially the new Resource-Resolution Strategy document), it seems that when you select en_IN, if any resource is not present in drawable-en-rIN, then it looks for the closest international english directory, which in your case in drawable-en-rCA. If its not present there, only then it default to the default drawable folder.
Hope it helps.
I am trying to localise strings to es_US (Spanish in US).
I have string resources in folder values-es-rUS and language on device is set to EspaƱol (Estados Unidos), Locale.getDefault() returns es_US.
Even when everything seems to be correct, app doesn't pick up strings from values-es-rUS but it falls to values.
Did someone make it work?
EDIT: Solved. Can't mark my answer as accepted now.
Problem was in gradle build file configuration. I use resConfigs "en", "es" so build can exclude other resources. It seems that "es" excludes also "es_US".
When I changed it to resConfigs "en", "es_US" it started to work
Folder should be placed in res/values-es_rUS
strings.xml files must have same names in all strings localized
*
From here (table 2 - section 2)
Language and region
The language is defined by a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code (preceded by lowercase "r").
The codes are not case-sensitive; the r prefix is used to distinguish the region portion. You cannot specify a region alone.
This can change during the life of your application if the user changes his or her language in the system settings. See Handling Runtime Changes for information about how this can affect your application during runtime.
See Localization for a complete guide to localizing your application for other languages.
Also see the locale configuration field, which indicates the current locale.
http://developer.android.com/guide/topics/resources/localization.html
I'm sure you've looked at this, but it has everything you need on it. I followed the instructions step by step and was able to localize my strings.
Perhaps you named your values folder incorrectly? That would be my guess
I am trying to localize my app and have a few doubts. i have translate strings in spanish language and i am trying to be very specific with Region codes, so I named the folders as values-es_rES, values-es_rUS and values-es_rMX. Now there are more countries and users who like to use spanish language so i created a generic values-es folder.
I am wondering can android automatically push all mexico, US and Spain users to respective languages under their region codes and can others like chile, peru will be shown values-es language rather than my default US English?
You have two options
Use the language-region locale (ie. es_ES for Spanish/Spain or es_PE for Spanish/Peru)
Use MNC/MCC codes in your resource folders, which will take presence over the locale ones.
The way you have described it, all users with a defined locale of es_XX (any region) will go to your "values-es" folder, but the US user will not, unless the US user has configured "es_US" as their locale.
Take a look at Table 2 at
http://developer.android.com/guide/topics/resources/providing-resources.html
Remember that if an asset is missing from "es_ES" it will get it from "es", so only change those that are different.
I am making an app in which I want to implement internationalization.
I have created alternative resources like
res/values-fr/strings.xml
which Contains French text for all the strings, including title
Can anyone tell me what to do next...
thanks
You should always have default strings in res/values/strings.xml, because Android tries to use the most specific resource available. If you have for example res/values-fr/strings.xml and res/values-de/strings.xml and the users phone is set to English, your app will crash because neither de nor fr are applicable for English there are no fallback resources.
After you have specified your default strings and any translations in their respective subfolders, you can use the strings by their qualifiers. For example R.string.some_string. Android will then use the most appropriate translation that is available for the users current device language.
All that and more is explained here: Localizing with Resources
Device will load locale automatically based on system languge. No extra steps required unless you want to change locale in your app independently.