2

I am developing an iOS app targeted almost exclusively at a Japanese audience, with the possibility of a small portion of english-speaking users.

All storyboards and xibs are being designed with Japanese strings, and localization into English should take place at a later stage.

From the beginning, the Project's Info/Localizations section in Xcode reads:

enter image description here

(The two files are, of course, "Main.storyboard" and "LaunchScreen.xib")

Because "English" is already added (as the development language), I can not click the "+" button and add it as a localization. I could add 'Japanese' instead, but I want it to be the Development Language, not just some (secondary) localization.

Also, and in an apparent contradiction with the above, The Target's Info.plist file reads:

enter image description here

When I select either of the localized files (Main.storyboard and LaunchScreen.xib) in the Project Navigator, and check the file inspector, the 'Localization' section reads:

enter image description here

...which seems to suggest that the existing, Japanese files (.xib and .storyboard) are the 'Base' and checking 'English' will add support for that language too (The pull-down menu seems to indicate that I can chose between using a strings file or a dedicated duplicate of the storyboard. I am inclined to believe the strings approach is better).

...So, how should I proceed?

A. Check the 'English' box in the File inspector / Localization section? This creates an en.lproj folder and adds a strings file inside it that I should translate later, I guess. This effectively seems to treat my existing Interface Builder files (populated with Japanese labels) as 'Base', and provide for localization into English through the strings file created (if I understand correctly). However, English as the Development Language in the Project settings remains somehow unsettling...

B. Remove English and instead add Japanese in the Project/Info/Localizations pane? This will make Japanese the Development Language, and I can re-add English as a localization afterwards. But for some reason, if I do this Japanese will not be treated as 'Base' language, and (unnecessary) string files will be also added for Japanese, not just for English.

EDIT: I found this question, which somehow provides a 'fix' for the option B above.

Community
  • 1
  • 1
Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189

1 Answers1

1

OK, this is what I settled for (but I will still accept better/smarter answers):

I did as suggested by the question I mentioned before, and edited the Xcode project file to force Japanese as the "Development Language":

developmentRegion = English;
            hasScannedForEncodings = 0;
            knownRegions = (
                en,
                Base,
            );

becomes:

developmentRegion = Japanese;
            hasScannedForEncodings = 0;
            knownRegions = (
                en,
                ja,
                Base,

Next, for the storyboards/xibs I want to localize, I will check the 'English' checkbox in the File inspector/Localization:

enter image description here

...and that will create my string files for English localization (Notice the 'Japanese' checkbox below 'English'. I'd rather it not be there at all, because the Base xibs/storyboards already have Japanese text labels by default, but I can just leave it unchecked).

Now, the Project's Info pane, 'Localizations' section looks like this:

enter image description here

ADDENDUM: Now that I think of it, with things setup like this, if someone ever launches this app on (say) an iPhone set to French, the app will fall back to Japanese (not English). This is probably not ideal, since the default language for non-Japanese speakers should be English, not the other way around.

However, I can not afford to design my xibs with English text and translate them to Japanese afterwards.

Community
  • 1
  • 1
Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189