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

enter image description here

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 :)

Upvotes: 2

Views: 925

Answers (1)

Eva Madrazo
Eva Madrazo

Reputation: 4731

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.

Upvotes: 0

Related Questions