简体   繁体   English

后备语言似乎不起作用(iOS / iPhone)

[英]Fallback language doesn't seem to work (iOS/iPhone)

This app has been under development for more than a year and has had multiple releases already. 该应用程序已经开发了一年多,并且已经发布了多个版本。 This development cycle I noticed that the "fallback" language doesn't seem to work anymore. 在这个开发周期中,我注意到“后备”语言似乎不再起作用。

The app had 3 targets: CountryA, CountryB and CountryC. 该应用程序有3个目标:CountryA,CountryB和CountryC。 Each target has the following localization directories: 每个目标都有以下本地化目录:

  • CountryA: en.lproj, langA.lproj, langB.lproj 国家/地区:en.lproj,langA.lproj,langB.lproj
  • CountryB: en.lproj CountryB:en.lproj
  • CountryC: en.lproj, langC.lproj CountryC:en.lproj,langC.lproj

In each targets info.plist a key "CFBundleDevelopmentRegion" with value "en" is specified. 在每个目标info.plist中,指定了值为“ en”的键“ CFBundleDevelopmentRegion”。

The project.pbxproj file has both the following key/values specified in the PBXProject section: project.pbxproj文件具有在PBXProject部分中指定的以下两个键/值:

  • developmentRegion = en; developmentRegion = en;
  • knownRegions = ( English, Japanese, French, German, en, fr, dk, da, nl, new, pt, de, ); knownRegions =(英语,日语,法语,德语,en,fr,dk,da,nl,new,pt,de,);

When I start the app on an iPhone or in the iPhone simulator with the system language set different from one of the specified localization directories the UI shows the NSLozalizedString identifiers instead of the localized strings. 当我在iPhone或iPhone模拟器中以与指定的本地化目录之一不同的系统语言设置启动应用程序时,UI会显示NSLozalizedString标识符而不是本地化的字符串。 Even when I specify "English" as System Language in iOS! 即使在iOS中将“英语”指定为系统语言时!

So... for some reason the en.lproj file is not picked up, because if I use langA or langB as System Language for target CountryA everything is as expected. 所以...出于某种原因,未选择en.lproj文件,因为如果我将langA或langB用作目标CountryA的系统语言,则一切都按预期进行。

Any help is appreciated! 任何帮助表示赞赏!

Kind regards, Niels R. 亲切的问候,Niels R.

NOTE: The problem is caused by a plugin of an external company that we had to integrate and which has a Localizable.strings file too. 注意:此问题是由我们必须集成的外部公司的插件引起的,该插件也具有Localizable.strings文件。 This will cause that "our" Localizable.strings is overwritten. 这将导致“我们的” Localizable.strings被覆盖。

Sorry to bother with this! 抱歉打扰了! Seems that I just had to look a little bit further before asking the question. 似乎我只需要进一步询问一点问题。

"the UI shows the NSLozalizedString identifiers instead of the localized strings" -- Are you adding the Localizable.strings file correctly for the individual targets? “ UI显示NSLozalizedString标识符而不是本地化字符串” –您是否为单个目标正确添加了Localizable.strings文件?

Another problem could be the "region" setting for languages. 另一个问题可能是语言的“区域”设置。 You should try to change the region too in the Simulator. 您也应该尝试在Simulator中更改区域。 I have seen unexpected things happening to NSLocale when setting the region to something totally different than the language. 将区域设置为与语言完全不同的区域时,NSLocale发生了意外情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM