如何使用非基本本地化在 Xcode 中预览 Storyboard [英] How to preview Storyboard in Xcode using Non-Base localisation

查看:25
本文介绍了如何使用非基本本地化在 Xcode 中预览 Storyboard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Xcode 5.1 中有一个情节提要,基本本地化为英语,第二个本地化为法语.

I have a Storyboard in Xcode 5.1 with a base Localization of English, and a second Localization in French.

当我使用 Xcode Storyboard 编辑器时,字符串按预期以英文显示.有什么方法可以让 Xcode 在我的其他本地化(法语)中显示 Storyboard?

When I'm using the Xcode Storyboard editor the strings are shown in English, as expected. Is there any way to make Xcode display the Storyboard in my other localization (French)?

我不想更改 Mac OSX 的语言,我希望 Xcode 中的某个地方有一个选项.

I don't want to change Mac OSX's language, I'm hoping there's an option in Xcode somewhere.

我的资源文件夹中有这个

I have this in my resources folder

如果我双击 Main.storyboard,故事板会按预期打开并显示英语(基本语言).

If I double-click Main.storyboard then the storyboard opens showing English (base language), as expected.

有没有办法查看 Main.storyboard,但显示 Main.strings 中显示的文本?

Is there a way to view Main.storyboard, but showing the text displayed in Main.strings?

我已经发现(感谢 这个教程)Xcode中有一个预览"选项.为此,打开故事板,单击助手"编辑器,单击助手编辑器菜单按钮"(紧邻助手窗口左上角 > 箭头的右侧)并选择预览.这显示了 ViewController 在横向/纵向 568/480 高模式下的外观.非常方便,但仍以英语显示所有内容.

I've since discovered (thanks to this tutorial) that there's a 'preview' option in Xcode. To get this, open the storyboard, click the 'assistant' editor, click the 'assistant editor menu button' (immediately to the right of the > arrow at the top left of the assistant window) and select Preview. This shows how the ViewController will look in landscape/portrait 568/480 high modes. Very handy, but still shows everything in English.

如果这能让我选择本地化,那将是检查文本布局在不同语言中是否有效的好方法..

If only this'd let me select a localization, it'd be a great way to check the text layout works in different languages..

推荐答案

我相信 Xcode 不准备在使用字符串文件时在 Interface Builder 中显示本地化的故事板.但是,它允许您非常轻松地转换格式.选择您的故事板文件,然后在实用程序面板中,选择您要预览的语言:

I believe that Xcode is not prepared to show localized storyboards in Interface Builder when using string files. However, it allows for you to convert formats quite easily. Select your storyboard file and in the utilities panel, select the language you want to preview:

将Localizable Strings"更改为Interface Build Cocoa Touch Storyboard":

Change the "Localizable Strings" to "Interface Build Cocoa Touch Storyboard":

您现在应该能够选择法语情节提要文件并在 IB 中预览它.

You should now be able to select the French storyboard file and preview it within IB.

完成后,您可以将文件转换回可本地化字符串",反转此过程,或使用您的源代码版本控制系统.然后,您可以通过任何必要的调整来更新基础文件,并再次使用此方法验证它是否符合您的喜好.

Once you are done, you can convert the file back to "Localizable Strings" reversing this procedure, or using your source code version control system. Then you can update the base file with any necessary adjustments, and verify it is to your liking using this method again.

这篇关于如何使用非基本本地化在 Xcode 中预览 Storyboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆