Xcode 10的基础国际化 [英] Base internationalisation with Xcode 10
问题描述
我的项目声明了两种语言:英语为开发语言,法语为其他语言.还打了Use Base Internationalization
.
My project declares two languages: English as development and French as additional. Also it has Use Base Internationalization
ticked.
在Xcode 9中本地化Strings文件时,通常将内容移至法语,然后在Localization
列表中打勾Base
.这样就给出了新Strings文件的两个副本,一个在Base.lproj
中(包含英语文本),另一个在fr.lproj
中,因此英语将用于除法语之外的其他语言.
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.
使用Xcode 10时,Localization
不会列出Base
,因此除了在Xcode 9中进行本地化然后使用已创建的基本文件还原到Xcode 10之外,我看不到其他使用Base.lproj
的方法
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?
更新20Sep18.
现在有XCode 10的正式版本,即使Use Base Internationalization
标志仍然存在,问题仍然存在.
如果这不是错误,那么有人可以解释发生了什么吗?应该有一个Apple文档对此进行讨论.
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,storyboard
或nib
在本地化时仍列出Base.仅Strings
文件似乎有问题.
BTW, a storyboard
or a nib
still list Base when localised. Only a Strings
file appears to have the issue.
推荐答案
之所以会发生这种情况,是因为iOS不仅会查找当前的系统语言. 它会在首选语言列表中寻找第一种受支持的语言.
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.
但是,当您在系统偏好设置中选择语言时,iOS会自动将此语言添加到首选语言列表中(设置-常规-语言和地区-首选语言顺序"部分).
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.
因此,"Base.lproj"文件不起作用.
So, the "Base.lproj" file doesn't work.
也许出于这个原因,Apple从Xcode 10中删除了"Base.lproj".
Perhaps for this reason, Apple removed "Base.lproj" from Xcode 10.
这篇关于Xcode 10的基础国际化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!