问题
I've looked through some internationalization documentation and videos on apple developer, but I never found an explicit answer to that question. In Apple's tutorials I see the Base.lproj
folder alongside en.lproj
and zh.lproj
-- the example translation (localization) is from English to Chinese. But they tell me that there's a file en.lproj/myStoryboard.strings
, and that is confusing. I can't see the point in creating an English localization for the storyboard (that is already in English).
- So my questions are if the user will ever see the strings in the
Base.lproj/myStoryboard.storyboard
? - Do the strings in that file have to be the default strings that are shown to the user if the system cannot find the user's preferred language folder in my bundle?
- Can I explicitly say "never use
Base.lproj/myStoryboard.storyboard
, always fall back onen.lproj/myStoryboard.strings
"?
In other words:
Let's say I want my app to display in English whenever the user's language isn't available, but that my Base.lproj/myStoryboard.storyboard
is in Swedish. Do I then have to localize the Base Storyboard to sv.lproj/myStoryboard.strings
and translate all strings in the Base storyboard to English to accomplish this?
回答1:
In my case, XCode 5 didn't create a en.lproj/myStoryboard.strings
, there's only the original storyboard in the Base.lproj
folder. Maybe it's an old XCode issue?
Try to remove that file and see if your app gets along with Base.lproj for default, English strings.
Your Info.plist file should have an entry Localization native development region
, which points to the lproj folder to be used in case the required string doesn't exist in the preferred language.
I'm not sure about this, but I think you have to use en
and UI with a Base.lproj
would automatically fallback to Base.lproj
.
Does that help you in any way?
回答2:
- So my questions are if the user will ever see the strings in the Base.lproj/myStoryboard.storyboard?
It is the default to use those strings for the development region localization, which is typically English. If there was a matching strings file for english, it would supersede the strings in the storyboard. This is typically redundant, so it isn't normally used. If you really want all of your languages to be handled identically, you can do this.
Do the strings in that file have to be the default strings that are shown to the user if the system cannot find the user's preferred language folder in my bundle?
These are unrelated concepts. The strings embedded in the storyboard are equivalent to having ones in en.lproj. After that, language fallback works the same as without Base.lproj.
Can I explicitly say "never use Base.lproj/myStoryboard.storyboard, always fall back on en.lproj/myStoryboard.strings"?
If you have en.lproj/myStoryboard.strings, and english is the development language, they will always superseded the strings embedded in Base.lproj/myStoryboard.storyboard for English. Including when English isn't the preferred language, but ends up being chosen as the fallback language.
来源:https://stackoverflow.com/questions/18114994/does-my-base-internationalization-storyboard-have-to-correspond-to-a-fallback-la