是否可以更新本地化故事板的字符串? [英] Is it possible to update a localized storyboard's strings?
问题描述
我通过为它创建了一个 base.lproj 故事板和 3 个字符串文件来本地化我的应用程序的一部分.这是一个月前,之后我向应用程序添加了新的视图控制器,但是该控制器的按钮和标签没有出现在字符串文件中
I localized a part of my application with creating a base.lproj storyboard and 3 string files for it. It was a month ago and after that I added new view controller to app, but this controller's buttons and labels not appear in string files
是否可以更新这 3 个故事板附加的字符串文件,或者我必须使用 NSLocalizableString 和 Localizable.strings 以编程方式添加新的字符串翻译?
Is it possible to update this 3 storyboard attached string files or I must add new strings translations programmatically with using NSLocalizableString and Localizable.strings?
推荐答案
有两个选项:
Xcode 可以重新加载"将文件转换为 [Interface Builder Cocoa Touch Storyboard] 文件类型或 [Localizable Strings] 文件类型.
Xcode can "reload" the file by converting the file to either an [Interface Builder Cocoa Touch Storyboard] file type or a [Localizable Strings] file type.
- 从项目导航器中选择您的基本故事板文件
- 在文件检查器中找到 Localization 部分
- 如果您的文件当前是 [Localizable Strings],请将其更改为 [Interface Builder Cocoa Touch Storyboard],反之亦然.
- Xcode 应该已将您的故事板转换为当前版本,同时保留您旧的本地化工作.如果您愿意,您可以在此处将文件改回原始文件类型.
选项 2
使用 ibtool 提取故事板中的字符串.
Option 2
Use ibtool to extract the strings in your storyboard.
打开终端应用程序
Open the Terminal application
找到您的 Base.lproj 目录
Locate your Base.lproj directory
使用这一行提取字符串:
Use this line to extract the strings:
ibtool MainStoryboard.storyboard --generate-strings-file file_name.strings
ibtool 将字符串提取到file_name.strings 后,您可以将其复制粘贴到您原来的.strings 文件中
After ibtool extracts the strings to file_name.strings, you can copy and paste it to your original .strings file
请访问:https://conyac.cc/business/columns/localization_guide_ios
这篇关于是否可以更新本地化故事板的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!