region locales do not work on iOS - ios

I need to add region locale for Switzerland to my app which already has the normal German localization.
So I just added it and now have a Localizable.String for Switzerland in my project. On the phone I set language to German and region to Switzerland.
But when I select German as language and Switzerland for region the code still shows the German text not picking up the translation from the swiss file.
All the other normal country locales work fine.
Is this a bug in iOS ?
Many thinks

There's no swiss language in the General-International-Language menu meaning you can't select it for localization. And the region is responsible for the formatting (e.g. date, time and currency formats).

Related

iOS app picks up secondary language or Spanish as the main language even though phone's primary language is English

I am having a strange bug where in iOS is picking up the second preferred language on the phone as the main language and showing the strings in that language. I use react-native and it started to happen after I upgraded to 0.64.0. For example, in the below screenshot, the month strings are shown in Hindi. Hindi is the second preferred language on the phone.
The Cancel and Select buttons are added by JS side code which appears fine in English language. After I removed Hindi as the second preferred language leaving only English as the phone language, the month string started to appear in Spanish.
I am not sure what is triggering it and how to fix this problem. Any kind of help is much appreciated. I provide Hindi and Spanish translations for the app and have InfoPlist.strings file present for Hindi and Spanish in the app. If I remove those string files, then the strings are shown in English as expected.
Please note that the problem is not limited to the date picker. It is for any of the dialogs shown by iOS. For example, if I select any text, the copy label appears in Spanish. I have attached some other screenshots where the problem can be seen.
Open the Settings app.
Navigate to a--name > Preferred Language > Language.
Change the preferred language to Spanish.
also try setting the preferred language to just English and forget the Hindi and let us know what happens. also good chance this might fix you up:https://github.com/formatjs/formatjs

Localization in Swift, Base, German, English, what's the correct way to do it?

I have a project which is nearly completed.
The language I used in Storyboard and in code is German. I use Base localization (which is German because the Strings in Storyboard and Code are German). The App is also localized in English.
Basically I want that every non-German user can use my App in English but I also want to use German language in Storyboard and code.
For that, I set the Base localization to English (I set the language to "EN" in project.pbxproj, and I set the language to "United States" in the Plist file).
What I want is working but I think this is not the correct way to do it because in my current configuration Xcode thinks that my Base is English (because I set it to English) but in fact it's German.
If I would set the Plist file and the project.pbxproj file back to DE users which are not German and not English would have to use my App in German. Or am I wrong?
What's the correct way to achieve that German users can use my App in German and all others should see the English version.
I think you should set the base language to English, add German for additional languages, so the APP for any users uses German on the phone will display German. Otherwise, the APP for all users who do not use German will display the base language, which is English. I hope this will help you.
Check this to set up the development language on XCode.

iOS Localization of bundle display name for en-GB and en-US

We are developing an app for football (Soccer). The app is only supporting English, but football has different meaning around the world. I.e in US / Australia / Japan / New Zealand they use soccer instead of football. We want to determine the display name based on the language selected on the device.
We want to achieve that the display name in US / Australia / Japan / New Zealand is "Soccer" and in the rest of the world it should be "Football".
Implementation
We thought after reading this documentation from Apple, that we could have a fallback language mechanism. So we implemented following.
We created a file called InfoPlist.strings that supports following:
en-GB
en-US
en-AU
en-NZ
ja
The InfoPlist.strings files is constructed like so:
en-GB
CFBundleDisplayName = "Football";
CFBundleName = "Football";
en-[US / AU / NZ] / ja
CFBundleDisplayName = "Soccer";
CFBundleName = "Soccer";
Project structure
Other than this we specified the CFBundleDevelopmentRegion in the Info.plist to en-GB / United Kingdom.
We have also tried to add following to the Info.plist but with no luck:
<key>CFBundleDisplayName</key>
<string>$(PRODUCT_NAME)</string>
<key>LSHasLocalizedDisplayName</key>
<true/>
When you are selecting one of the supported languages as preferred language on the device it works fine. But when you choose a not supported language (i.e. German) it falls back to the en-US localization. Can you help us understand that?
In theory the OS looks up the preferred language (in this case German), and finds out that it is not supported. After that, if it the has the base language (without a dialect) supported it will use that one. It is also not available in this case. Then it end up at the last step:
If none of the user’s preferred languages are supported by your app, iOS chooses the language matching your app's development region (CFBundleDevelopmentRegion).
In our case we have CFBundleDevelopmentRegion defined to en-GB / United Kingdom.
We will expect to see "Football" as the display name, but we see "Soccer" (en-US localization). We don't understand.
Hope you can help us - thanks in advance :)
I am experiencing same issue in ios 14, seems a bug, whenever there is definicion for a specific locale en-XX the general one is never used. Instead, the alphabetical order is used for the specific ones.
https://developer.apple.com/forums/thread/663628
In order to workaround this, there is an specific language en-001, I add that to the project and fill the values with the default ones. So it always solve the not defined specific with en-001 definition.

How does localization works for languages and countries?

What I mean is this: suppose I localize my app to french (not specifying a country), will that version be used by any one that is using variations of that language?
French is spoken by more than 30 countries worldwide. Lets take Switzerland for example, where french and german are official languages. French for Switzerland is localized as fr-CH and will have that folder inside the application. If my app is localized just for french, will a person in Switzerland with a device configured for fr-CH see the french version or the default one?
If you go to the iOS settings, you'll see only one option for French, there's no variation. So you can just use fr.
I had an app localized for Brazilian Portuguese, when it should be Portuguese (pt) instead. pt-BR wasn't working. So be careful. You may want to try and change few strings and see what will come out.

Localization IOS default Language

I have build an iphone app and I started with Dutch texts in the app. I would like to expand it to other countries so I Localized the app and added English.
So I have now to localization folders en.lproj and nl.lproj.
When I install the app on the iphone and set the language to Dutch I get the Dutch language in the App. When I switch to English I get this. But when I switch to German I get the Dutch language. I would like to have default the English language when the is no localization folder for it.
How do I do this?
A little late to the party, but just recently run into this issue and somebody helped me, so here is the magic:
Suppose your app supports English and Spanish.
If the list of languages in the Settings app is Portuguese, Spanish, English then Spanish will be shown to the user. If the list has been Portuguese, English, Spanish then English would be shown to the user.
In short, the language are loaded in order, so if you want English to be loaded when German (or any other missing language) is set, your settings screen should read:
German | English | Dutch | everything else
But you don't know how your users has the languages set and English might be at the bottom. So far, the best solution workaround I found was to manually change the Locale order on startup so English is always second, and therefore, default.
In your Info.plist you have to set the Localization native development region to English (en) and it should work fine.

Resources