Is Android device's locale based solely on Language setting? - locale

If the device chooses French as the language, will the locale automatically set to French as well? Or does it depend on user's current location?
For iOS, language and region are separate settings while in Android, seems like we only get to choose Language but not the region.
Comparison:
Android - Chooses French language, locale becomes fr-FR
iOS - Chooses English language, French region, locale becomes en-FR
For Android is there any other way to retrieve device's region?
I have been Googling around but couldn't find a good source of information on this topic yet.

In Android you can select Portuguese (Portugal) or Portuguese (Brasil) which translates to pt-PT and pt-BR. In this case there are two different languages, which I personally find it redundant, because the better way of handling this would be to separate languages and regions.
However you can programmatically change the language and region, by setting:
new Locale("pt", "PT");
You can read more about programmatically changing the language here:
http://gunhansancar.com/change-language-programmatically-in-android/
http://www.sureshjoshi.com/mobile/changing-android-locale-programmatically/
or anywhere on Stackoverflow :) there are lots of articles written about it

Related

Django, i18n, problems with translation after changing LANGUAGE_CODE

I have created a multilingual website using Django i18n. But later I needed to change the default language (before LANGUAGE_CODE='ru') to one of those that were in the LANGUAGES configuration setting (now LANGUAGE_CODE='uk').
After that, when the user opens this site and selects the language 'ru', the translation does not work correctly. The models translate correctly, but the templates remain in 'uk'.
At the same time, when the user opens this website and selects the language 'uk' or 'en', the translation works without problems.
Tell me please, what is the reason and how can I solve this problem, or at least where it would be reasonable to search?
The problem was that the translation from Russian into Russian was not completed, so the translation from Russian into Ukrainian was taken.
While the default was Russian, no translation was made at all, since there is no translation to this node in the default language. And when it became Ukrainian, in the absence of a translation, translation into Ukrainian began to be used.

Android Studio use one specific language for all other than default

How do I set Android Studio project to use English translation for all locales other than the default language? If I have values/ and values-en/ directories, I want all locales other than the default to use the English translation.
I think you should a bit change your mind and think that all locales should use English translation but in one case (let's say for Spanish) should be no-English. Set values as your English directory and values-xxx for this as you said default case.
If a guy would have a phone with this default locale, he would have no-English translation, otherwise it would be translated to English.
Hope it will help

Calabash - iOS Simulator fails to select keyboard language

I’m novice at Calabash testing and faced an obstacle while trying to make a multi-language app.
Here is my test scenario:
- I select a textfield.
- Enter a string with one language and then enter some text with another.
And here occurs the obstacle: when I try to switch the language through the tests - it fails. I mean the application tries to find a symbol for the next language and loops endlessly because current keyboard layout doesn’t contain it.
The only solution I found yet is to switch a layout manually but thats not an option actually for real testing.
How could I fix it?
There are two steps:
Use Calabash command line tools to change the language and locale of the simulator.
Launch the app with arguments to set the preferred language and locale.
The complete reference can be found on this Calabash iOS wiki page: Change Locale and Language
# Set the simulator language to Swiss German and locale to Swiss French
$ calabash-ios sim locale de-CH fr_CH
# In your Before hook, tell Calabash to launch the app in the locale and language.
options = {
# Launch with Swiss German as the primary language and Swiss French as the locale.
:args => ["-AppleLanguages", "(de-CH)",
"-AppleLocale", "fr_CH"]
}
launcher.relaunch(options)

allow users to switch between input languages inside a j2me java midlet keyboard qwerty E71 and such

We have a midlet that needs to allow the user to switch input languages on the fly (its a dictionary type app) between several languages (say English to Arabic etc). All was charming in the "old days" with the numeric keypad, we handled the input ourselves matching 2 clicks on the 5 to feed the correct char to our program. Then came the E71 out, it has a qwerty keyboard and in our canvas KeyPressed we get the character the user pressed, say "a" on the keyboard,
now the task of matching this to the correct language (say the user is now searching for the Arabic to English side of the dictionary) involves the task of matching "a" (on the qwerty layout I guess) to the arabic letter that would come out if the layout was arabic.
There is a special keyboard shortcut in these S60 devices (varies between devices) that allows the user to pop the input language selector (function + space in the case of E71) but these does not seem to work when our midlet is running.
another suggested solution was to somehow use an editable textfield for the input in which case a standard support for changing the input language is offered by the jvm, however we render a canvas (a nice looking one) and replacing this with a textfield is a last resort for us.
So, the question we have is what other solution can someone think of to tackle this issue?
or if anyone found a way around this annoyance?
best regards,
--tzurs
I think you can do the mapping using the Nokia specific system properties for keypad settings. Using com.nokia.keyboard.type, com.nokia.key.scancode and com.nokia.key.modifier you should be able to create a generic enough solution for Nokia devices.
More info on these system properties available on Nokia docs

Making an MFC application international

I've got several large MFC applications here, and converting them into any other format is out of the question. We're expanding into other markets, and would like to make the apps work in other languages and cultures.
So far, I've found occasional references as to what to do with Visual C++ version 6, with one mention that later versions of MFC have additional relevant features. Searching MSDN gives me instructions on how to convert the apps to Unicode, which we already did. I found nothing on MSDN on how to make languages multilingual once they're in Unicode, only a few older things using Google, and one book about internationalization using VC++6. (We're using Visual Studio 2008 now, on XP and Vista.)
I make no claims for the strength of my Google-fu, and would be happy to be directed to things I've missed.
Is it reasonable to use the methods of VC++6, or should I use later features?
If I should use features later than that, where can I find some reference to them?
Is there something I should worry about other than setting the locale, converting all strings to resources, and duplicating resources in different languages?
I can find more things about .NET internationalization, but I'm inexperienced in .NET. What will I find there that's applicable to VC++ and MFC?
Edit: I just ran into difficulties trying to put Unicode strings into the String Table resource. (As far as I can tell, Unicode strings need to be entered into the .rc file with a text editor, in L"0x0034" form. I haven't found a resource editor way to do that.) Any tips on that? Any other resource I can use in VS2008 using VC++ and MFC?
Edit: Somebody on a Microsoft forum suggested that I open the offending .rc file in Notepad, and save it in Unicode. Unfortunately, this doesn't seem to fix the dialogs, although the stringtable seems to be working in Japanese.
There's a lot more than just translating "strings" to internationalize an application.
Most of your UI will need to be updated to take into account the different text lengths, and language orientation (thing Hebrew, Chinese, Arabic, ...)
Some images will also need to be changed to fit a different culture (unfortunately, I don't have an example for that), either the figurative is different or the colors do not fit local specifications.
We are using a tool like appTranslator to help us do the cosmetic localization (UI re-formatting) and use a professional technical translator for the strings.
You can also create a resource only dll
See How To Create Localized Resource DLLs for MFC Application for more details.
You can internationalize your application using the following ways.
After you converted the application to unicode (you already did) and all the strings should be loaded from String table.
For each language you need to change the string table and compile
One more way is to maintain a XML file which contains all the strings in the localized format. Load the xml and strings depending on the language.
Here's a CodeProject article of mine that describes very "coding-efficient" method to pull strings from the string table (required for translatable texts):
http://www.codeproject.com/KB/string/stringtable.aspx
Here's another class that help your app pick the right UI language. It also helps you create a language selection menu:
http://www.codeproject.com/KB/locale/LanguageMenu.aspx
Last but not least, appTranslator is a tool that helps you translate the UI of your app, detect what changes were made in resources since the last version, create translated exe or resource DLLs and much more:
http://www.apptranslator.com
(Note: I'm the author of appTranslator.)

Resources