Catalan and Basque resources in Android
Asked Answered
P

6

12

When you want to add locale-specific resources in Android, you have to add the lowercase ISO-3166-1 code of the language to the resource folder's name. So far so good.

Now I want to add Catalan and Basque strings to my application. According to the ISO list, I would have to add values-ca and values-eu. But will that work, actually?

Edit: With a custom language chooser in your app, you can provide support for languages even when they're not in the device's settings menu. I've made the library that I use for this available on GitHub: https://github.com/delight-im/Android-Languages

I don't know if Android supports all ISO codes and if these "minor" languages will be displayed at all. If Android is not available in these languages, perhaps the device will not even recognize this language as its default locale and just use es for Spanish.

Can someone help?

Peacetime answered 6/12, 2012 at 1:22 Comment(14)
See this https://mcmap.net/q/503454/-localization-android and this #7973523. I think ca is available from Gingerbread, I don't think the same about the basque language.Versicular
Thank you! Catalan seems to be officially supported since Android 2.3, yes. But Basque doesn't seem to be supported at all (officially). Therefore my question: Can you use a language which Android itself has not been translated to?Peacetime
I haven't done this my self but check the documentation for the Locale class in the docs developer.android.com/reference/java/util/Locale.html and see if you can't build your own.Versicular
The Locale class is what pulls the strings in the background and determines what language your app is shown in? I doubt that.Peacetime
I doubt it myself, it was a suggestion. Try to ask this question on the android google groups.Versicular
Sorry, didn't want to deny it rudely. First I'll try here on SO, and if nobody knows here (which I doubt again ;D) I'll ask in the Android groups.Peacetime
If android does not support basque, I think the only way is to add this language in your app settings and use different string names (one name for basque language and one string name for other languages with different values)Mythos
Nothing stops you to create resource directories for any language_region combination. If the current language of the phone is set to one of the combinations with special folders present in your application, the application will use those resources instead of the default ones. If the current phone language is not one of the languages supported by your application, the default folders (without language/region specification) will be read. But all this is an automatic operation system <-> application interaction. So, if the user has a phone in Euskera, the appropriate folder will be used.Perspicacious
Thank you. The point is: If Android does not supported Basque language at all, you cannot set your language to Basque in the phone's settings, probably. And if you cannot set your language to Basque, the values-eu folder will probably never be used. True?Peacetime
@MarcoW. Yes correct. If a language cannot be set in Android settings, it cannot be used. Hence, the remark that Catalan is supported since Gingerbread. From what I've read before, it would be pointless to translate in basque today.Robrobaina
@rds: This is what I wanted to know. Thank you! But do you have any proof or reference? I guess there could be some device manufacturers that deploy a custom version of Android including Basque language files, couldn't that happen?Peacetime
Not entirely correct - many devices ship with a limited selection of languages in the settings menu, but can actually be set to any system locale using an app such as LocaleSwitch It should be pretty easy to test whether Jorge's suggestion is correct by adding a custom locale in LocaleSwitch and then adding the resource folder to see if the system does it automatically. Gingerbread 'support' for Catalan may only reference the inclusing of android.R values since 2.3.Flannelette
Very interesting, thank you @DavidCaunt! I've just set the locale to eu using LocaleSwitch, and guess what - the system's "Settings" app has just been renamed to "Ezarpenak" (which is Basque). In addition to that, the app uses the Basque resources. So has Android been translated to Basque and does it support this language? It seems so.Peacetime
@MarcoW. I've written up the comment as a more formal answer. Does your app load from values-eu when the locale is set?Flannelette
F
6

Many devices ship with a limited selection of languages in the settings menu, but can actually be set to any system locale using an app such as LocaleSwitch.

It should be pretty easy to test whether Basque is supported by adding a custom locale in LocaleSwitch and then adding the resource folder to see if the system loads the resources from this folder automatically.

Finally, Gingerbread 'support' for Catalan may only reference the inclusion of android.R values since 2.3, though I can't see them in the framework repository.

Flannelette answered 17/12, 2012 at 11:21 Comment(2)
Thank you! Yes, the app loads the resources from values-eu when I've set the locale to Basque using LocaleSwitch. And surprisingly, Android (4.0) seems to support the Basque language as well, as the contacts app, the settings app and so on changed their names to Basque equivalents. But I guess most users won't be able to set their language to Basque and so the resources won't be loaded.Peacetime
That's great news! Let's hope that some manufacturers are providing the Basque setting on phones retailing in the relevant countries. In any case, you could provide a Setting in your app to set the locale.Flannelette
E
1

Actually not all languages are documented at Android docs and many brands did your custom version of Android which may change its list, but be sure that if a device has Catalan and/or Basque suports it will use ISO standard, and the values will got rigth as it is converted with string comparision.

Maybe it would be a good choice to put a handed changer if you got that most devices do not have this support on your tests.

Evelunn answered 17/12, 2012 at 11:14 Comment(2)
Thank you! So you suggest a solution like this? #2900523Peacetime
I had never used that, but it looks more beautiful than what I was thinking, that was making a handed converter... something similar to the one system uses but you have to load your files, use you getString() and the worst part, load every string by code.Evelunn
S
1

The thing is, if the language is not listed in the language selection list on the device, the resources can never be used as the device can never be put in this configuration by the user.

On the other hand, if the device allows you to select Basque, it will be using this format, and your resources will be used.

Stadtholder answered 17/12, 2012 at 11:17 Comment(2)
Thanks! As I've seen with my Samsung Galaxy Tab 2 (Android 4.0.3), Android seems to support Basque already. But nevertheless, this language was not there for selection in my phone's settings. So I need to hope Basque providers add the Basque language to the list of available languages, otherwise my resources will never be loaded, right?Peacetime
you can always use https://mcmap.net/q/1011712/-force-quot-locale-quot-in-application to change the locale form within the app, but the side effects on the system may vary.Stadtholder
D
1

We can now create our "values-eu-rES" folder and have our app in Basque, Android Lollipop has made it.

Dannica answered 3/12, 2014 at 15:59 Comment(0)
A
0

We can create a folder

Basque strings -> value-eu [Basque]

another folder

Catalan strings -> value-ca [Catalan]

enter image description here

Aguie answered 5/6, 2020 at 9:10 Comment(0)
S
-2

Adding a new language in LocaleSwitch, you need to type the ISO 639-1 code. For instance, if you want to switch to basque you need to enter "eu". Afterwards, you will see the new locale as "vasco".

That makes me think that basque locale is supported by android.

Smitherman answered 6/2, 2013 at 15:46 Comment(3)
No, it does not hint at Android supporting this locale. First of all, Android has no language-specific resources for that locale. And second, most Android versions don't list "Basque" in the language settings.Peacetime
You are not right. I'm coding an application and I'm able to do that. basque code is 'eu' as catalan code is 'cat'. I mean, Android does not support directly basque, but Locale class of Java does it ;).Smitherman
No, you've misunderstood what I wanted to say. Java's Locale class accepts whatever locale string you pass in - just everything will work. But the Android system has no translation for some uncommon languages and Android's locale selection in the settings menu won't let you choose "Basque", e.g., because it does not offer that option in the list. But that depends on the version, on the manufacturer, etc., as I've said.Peacetime

© 2022 - 2024 — McMap. All rights reserved.