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

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

问题描述

我在Xcode 5.1中有一个故事板,其基础是英语本地化,第二个是法语本地化。



当我使用Xcode Storyboard编辑器时,字符串以英语显示,正如预期的那样。有没有办法让Xcode在我的其他本地化(法语)中显示故事板?



我不想改变Mac OSX的语言,我希望Xcode中有一个选项。



<编辑:我在我的资源文件夹中有这个



如果我双击Main.storyboard,则故事板会打开,显示英语(基本语言),如预期的那样。



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



编辑:
我发现了(感谢本教程)Xcode中有一个预览选项。要获得此功能,请打开故事板,单击助手编辑器,单击助理编辑器菜单按钮(紧靠助手窗口左上角的>箭头右侧),然后选择预览。这显示了ViewController在横向/纵向568/480高模式下的外观。非常方便,但仍然用英语显示一切。



如果只是这样我可以选择本地化,那么检查文本布局的工作方式就不错了。



解决方案

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





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





你应该现在可以选择法国故事板文件并在IB中预览它。



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


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

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)?

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

EDIT: I have this in my resources folder

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

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

EDIT: 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..

解决方案

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:

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

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天全站免登陆