I'd expect the base file to contain my English words since my project has "Localization native development region" set to English.

Update - to clarify my question:

enter image description here

有帮助吗?

解决方案 2

Although I am not entirely sure if I get this correctly, I will try to answer your question TTBOMK.

Suppose you’re using NSLocalizedString(key, comment) from in your code. You can clearly see that the first argument is actually is a key for a string, rather than the translated (or to be translated) string itself. Therefore when you “write code” you actually don’t write strings in base language — or any other language for that matter. You should think it as if you're adding string placeholders in your code.

Later on, you’re supposed to create a Localizable.strings file for each language you would like to support, in the form of key = value;. To make your UI appear at least in one humanly–readable language you should at least have one Localizable.strings file with proper string values for each placeholder key.

For example: if you had NSLocalizedString(@“ConfirmationButtonTitle", @“Yada yada”) in your code, then it makes totally sense having a Localizable.strings file that contains ”ConfirmationButtonTitle” = “Tap here to confirm”; element in it. If you don’t create a Localizable.strings file or no Localizable.strings file contain ConfirmationButtonTitle key, then button title falls back to ConfirmationButtonTitle, since it is the name of the placeholder key.

Having said that, most people prefer naming their keys exactly as string values for various reasons. This is arguably a convenient — and very common — practice, but could lead to conflicts in people’s minds.

So, if you were to create the previous NSLocalizedString example like NSLocalizedString(@“Tap here to confirm", @“Yada yada”) instead, then your default/base Localizable.strings file would probably contain an element like “Tap here to confirm” = “Tap here to confirm”;.

What happens here isn’t that you’re repeating yourself, but instead you’re naming your key exactly as your base language’s string value, that’s all.

EDIT

There always have been a base language concept, but as I understand it Xcode 5 emphasizes this even more: that’s good. If your base language is English, then you don’t have to have a Localizable.strings file for English, again.

其他提示

Apart from addressing question what language end-users will see, you need to consider also what will be shown in the AppStore. My current experience is that if you use Base for English, English won't appear in list of supported languages (how Apple knows in which language your base localization is) in the description of your app.

I've met this issue myself - base (English), German and Russian

Target settings refer to:

Localization native development region = en

But on Appstore it appears in this form:

Languages: German, Russian

no reference to English

I consider to duplicate base localization to English (not a high priority, as users see from screenshots that App works in English anyway)

Edit: there seem to be a different behavior in iOS8 - Application Settings (Settings.bundle) seem to ignore Base translation, if any of translations match your "Preferred Language Order".

In other words, App is localized: Base, German, Russian. iPhone is configured to use English, preferred languages order is English, German, Russian.

Application settings come in ... German!

Once again: this is applied to Settings only not to the application itself!

According to the documentation (scroll down to Creating Strings Files for User-Facing Text in Your Code), you shouldn't add Localizable.strings to the Base localization. Even if your development language is English, create a separate folder and Localizable.strings for English. Create others for each additional language you want to add.

Further reading

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top