使用XIB在iOS中进行本地化(Interface Builder)

时间:2022-09-06 20:10:29

I have searched now quite a bit on * for an answer, but I can't seem to find an adequate one.

我现在已经在*上搜索了很多答案,但我似乎找不到合适的答案。

So, I am localizing an App with XCode. Everything works fine, I have localized a storyboard and everything. The last part which needs to be localized are the labels and buttons in XIB Files. Here I have the following Problem:

所以,我正在使用XCode本地化一个应用程序。一切正常,我已经本地化了故事板和一切。需要本地化的最后一部分是XIB文件中的标签和按钮。这里我有以下问题:

XCode Offers me to create localized Xib Files for every language or to create strings files. Both options are fine with me, but none seems to work. One answer to a similar question stated that this does not work my design. If so, why does XCode give me the option to do it in the first place? And, what is a good and easy solution for this?

XCode让我为每种语言创建本地化的Xib文件或创建字符串文件。这两个选项都适合我,但似乎都没有。对类似问题的一个答案表明,这对我的设计不起作用。如果是这样,为什么XCode首先让我选择这样做?而且,什么是一个好的和简单的解决方案?

And I am using Swift, not sure if that really matters, I just thought I mention it.

我正在使用Swift,不确定这是否真的重要,我只是想提到它。

1 个解决方案

#1


0  

There is a known issue with recent versions of Xcode where the simulator would not correctly pass the language information to the app, so it seemed as if localization was not working. If that is your problem, there are two workarounds:

Xcode的最新版本存在一个已知问题,即模拟器无法正确地将语言信息传递给应用程序,因此本地化似乎无法正常工作。如果这是您的问题,有两种解决方法:

  1. try your app on a device and confirm switching the language brings up your localized strings.
  2. 在设备上试用您的应用并确认切换语言会显示您的本地化字符串。

  3. force the language via your build scheme (Product => Scheme => Edit Scheme... => Run => Application Language)
  4. 通过构建方案强制语言(Product => Scheme => Edit Scheme ... => Run => Application Language)

#1


0  

There is a known issue with recent versions of Xcode where the simulator would not correctly pass the language information to the app, so it seemed as if localization was not working. If that is your problem, there are two workarounds:

Xcode的最新版本存在一个已知问题,即模拟器无法正确地将语言信息传递给应用程序,因此本地化似乎无法正常工作。如果这是您的问题,有两种解决方法:

  1. try your app on a device and confirm switching the language brings up your localized strings.
  2. 在设备上试用您的应用并确认切换语言会显示您的本地化字符串。

  3. force the language via your build scheme (Product => Scheme => Edit Scheme... => Run => Application Language)
  4. 通过构建方案强制语言(Product => Scheme => Edit Scheme ... => Run => Application Language)