问题
My project declares two languages: English as development and French as additional. Also it has Use Base Internationalization
ticked.
When I localise a Strings file in Xcode 9, I normally move the content to French, then tick Base
in Localization
list. This gives two copies of the new Strings file one in Base.lproj
(containing English text), another in fr.lproj
, so English will be used for a language other than French.
With Xcode 10, the Localization
doesn't list Base
, so I can't see a way to use Base.lproj
other than doing localisation in Xcode 9 and then revert to Xcode 10 with Base file already created.
Is that a bug, or this is how it is meant to be?
Update 20Sep18.
Now there is an official release of XCode 10 and the issue persists even though Use Base Internationalization
flag is still there.
If this is not a bug, can someone explain what is going on? There should be an Apple documentation to discuss that.
BTW, a storyboard
or a nib
still list Base when localised. Only a Strings
file appears to have the issue.
回答1:
This happens because iOS doesn't only looks for the current system language. It looks for the first supported language in the list of preferred languages.
But when you choose language in system preferences, iOS automatically adds this language to the list of preferred languages (Settings -- General -- Language & Region -- "Preferred language order" section).
Thus, when you change language to unsupported language, the app selected the second language in the "Preferred language order" list.
So, the "Base.lproj" file doesn't work.
Perhaps for this reason, Apple removed "Base.lproj" from Xcode 10.
来源:https://stackoverflow.com/questions/51742614/base-internationalisation-with-xcode-10