Swift:情节提要中的本地化-标签未添加到Main.strings吗? [英] Swift: Localization in Storyboard - Labels not added to Main.strings?

查看:99
本文介绍了Swift:情节提要中的本地化-标签未添加到Main.strings吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试本地化应用程序并为目标语言创建一个新的Main.strings文件时,我在界面生成器中创建的所有内容(标签,按钮,...)都将添加到新的Main.strings文件中(基本版本和语言版本),我可以相应地本地化文本.

When I try to localize my app and I create a new Main.strings file for the target language, everything I have created in interface builder (labels, buttons, ...) is added to the new Main.strings files (base and language versions) and I can localize the text accordingly.

但是当我以后在界面构建器中向ViewController添加标签或按钮时,它不会自动添加到基本版本和语言版本的Main.strings文件中.

But when I later add a label or a button to a ViewController in interface builder, it is not automatically added to the Main.strings files for the base and language version.

那么,如何确定按钮/标签的ObjectID是什么,以便可以将其添加到字符串文件中?

So, how can I find out what the ObjectID for the button/label is so that I can add it to the strings files?

还是有另一种方法来强制Xcode自动向这些文件添加新添加的标签和按钮?

Or is there another way to force Xcode to add newly added labels and buttons to those files automatically?

推荐答案

从情节提要中选择UILabel后,您可以在右侧面板中找到UILabel的对象ID:

After selecting UILabel from storyboard, You can find object id of UILabel in right panel:

然后您可以在Main.string文件中设置标签文本,如下所示:

Then you can set text of label as below in your Main.string file:

"v12-vM-an5.text" = "Phone";

这篇关于Swift:情节提要中的本地化-标签未添加到Main.strings吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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