Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does my Base Internationalization storyboard have to correspond to a fallback language for all unlocalized languages and strings?

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

  1. So my questions are if the user will ever see the strings in the Base.lproj/myStoryboard.storyboard?
  2. 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?
  3. Can I explicitly say "never use Base.lproj/myStoryboard.storyboard, always fall back on en.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?

like image 264
Andreas Avatar asked Aug 07 '13 22:08

Andreas


People also ask

What is use base internationalization?

Using Base Internationalization. Base internationalization separates user-facing strings from .storyboard and .xib files. It relieves localizers of the need to modify .storyboard and .xib files in Interface Builder.

What is base localization?

There is also a concept called a “Base” localization. Xcode will by default add a directory called “/Base. lproj” to your project. The purpose of this directory is to hold the default layouts of your views (i.e. storyboards/XIBs) in your “development language”.

What is CFBundleDevelopmentRegion?

A Boolean value that enables the Caps Lock key to switch between Latin and non-Latin input sources. Current page is CFBundleDevelopmentRegion.

What is Lproj Xcode?

lproj folder is a directory that stores language-specific resources. See Localized Resources in Bundles and Language and Locale IDs for details. If none of the user's preferred languages are supported by your app, iOS chooses the language matching your app's development region ( CFBundleDevelopmentRegion ).


2 Answers

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?

like image 100
Kof Avatar answered Oct 18 '22 01:10

Kof


  1. 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.

like image 33
Jon Hess Avatar answered Oct 18 '22 02:10

Jon Hess