When an Xcode project of iOS app is newly created, in the project (not target) setting we can see that it has Use Base internationalization
enabled by default, and there are 2 files localized for the Development Language
which is English
by default (one for Main.storyboard
and one for LaunchScreen.storyboard
, both of which reside in the Base.lproj
directory). See below the screenshot:
(For simplicity, I will only mention Main.storyboard
from now on.)
And in the localization section of Main.storyboard
's right-side panel, we can see that the Base
localization is checked by default and there is also an English
localization which is unchecked by default. See below the screenshot:
And in the target's Info.plist
, there is a key named Localization native development region
(i.e. CFBundleDevelopmentRegion
), and its default value is en
. See below the screen shot:
If I understand it correctly, with these default settings, developer can just write English in the Base
localization of Main.storyboard
and leave the English
localization as unchecked. If the app needs to adapt to some other language, developer can add a localization in the project localization setting, and select Main.storyboard
in the popped up dialog. See below the screenshot:
Take Chinese (Simplified)
as an example, this will result in a newly created directory zh-Hans.lproj
with a Main.strings
file inside it. (For simplicity, I will refer to it as Chinese
instead of Chinese (Simplified)
.) Developer just needs to translate the English strings inside this file into Chinese (the newly created Main.strings
in the zh-Hans.lproj
directory by default has all the English texts duplicated from the Main.storyboard
in Base.lproj
). With these settings, the Language
field in the description of this app on AppStore will list English (from the Base
localization, because English is the development language
) and Chinese (from the Chinese
localization). On end-user's device, if the system language is English/Chinese (or English/Chinese is among the preferred language), the app will use the corresponding language resource (for English, use the Base
localization; for Chinese, use the Chinese
localization). For all other language preference, English will act as the fallback language because CFBundleDevelopmentRegion
is en
, so Base
localization is used.
So my first question will be, is the above understanding correct? To summarize, with the development language
being English, we don't need to enable English
localization for storyboard files. Just use the Base
localization and directly write English in the storyboard files. We only need to add localization for languages other than English. (Actually it seems troublesome if we enable the English
localization. If English
localization is enabled, then we need to maintain both the texts in Base.lproj/Main.storyboard
and en.lproj/Main.strings
.)
If the above understanding is correct, my second question will be, how to achieve internationalization in a reverse way? That is to say, if I would like to use Chinese
as the development language
and write Chinese in the Base
localization, and only add localization for languages other than Chinese
, is it possible and how to do that in Xcode? I can't find a way to change the development language
in the project setting in order to claim that the Base
localization in the project is Chinese
rather than English
.
See Question&Answers more detail:
os