热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在Xcode6.0中导入.xliff本地化文件-Importing.xlifflocalizationfilesinXcode6.0

Applehasrecentlyintroducedanewprocessfortranslatingfiles.Younolongerhavetousegenstri

Apple has recently introduced a new process for translating files. You no longer have to use genstrings/ibtool for generating .strings file - instead you simply use the .xliff files export/import tool built right into Xcode:

Apple最近推出了一种翻译文件的新流程。您不再需要使用genstrings / ibtool来生成.strings文件 - 而只需使用内置于Xcode中的.xliff文件导出/导入工具:

https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html

https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html

Unfortunately when I'm trying to import right from Xcode, it crashes. I wanted to test it out using xcodebuild -importLocalizations as is described here (page 68):

不幸的是,当我尝试从Xcode导入时,它崩溃了。我想使用xcodebuild -importLocalizations测试它,如此处所述(第68页):

https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/BPInternational.pdf

https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/BPInternational.pdf

It turns out that there's no such importLocalizations argument for xcodebuild (although there is an exportLocalization)?! (man command confirms this) Am I missing something? This has also been tested in Xcode 6.1.

事实证明xcodebuild没有这样的importLocalizations参数(虽然有一个exportLocalization)?! (man命令证实了这一点)我错过了什么吗?这也在Xcode 6.1中进行了测试。

6 个解决方案

#1


3  

It importing via the command line works now on Xcode 7

它通过命令行导入现在可以在Xcode 7上运行

xcodebuild -importLocalizations \
           -project MyProj.xcodeproj \
           -localizationPath es.xlf

#2


0  

One reason for the crash is, if the xliff file contains any empty localisable strings, then xcode will crash while importing it.

崩溃的一个原因是,如果xliff文件包含任何空的可本地化字符串,则xcode将在导入时崩溃。

Re-create the xliff will and make sure there are no strings left blank.

重新创建xliff将确保没有字符串留空。

#3


0  

I had the same problem and in my case I figured out that the running SourceTree application was the problem! I closed it and reimported successfully. Maybe it modifies something while importing.

我有同样的问题,在我的情况下,我发现正在运行的SourceTree应用程序是问题!我关闭它并成功重新导入。也许它会在导入时修改某些内容。

#4


0  

Xcode 7.3.1 has fixed bug with crashing while importing localisations from xliffs. To prevent Xcode before 7.3.1 from crashing, you have to include all localised strings from all targets in your xliff file

Xcode 7.3.1修复了从xliffs导入本地化时崩溃的问题。为了防止7.3.1之前的Xcode崩溃,您必须包含xliff文件中所有目标的所有本地化字符串

#5


-1  

If you could post the XLIFF you're trying to import, that may be helpful. I haven't experienced crashes importing localizations from XLIFF with Xcode 6.1.

如果你可以发布你想要导入的XLIFF,那可能会有所帮助。我没有遇到过使用Xcode 6.1从XLIFF导入本地化的崩溃。

#6


-1  

The .xliff localization files can now be imported/exported from Xcode's UI:

现在可以从Xcode的UI导入/导出.xliff本地化文件:

Select your project file in the Xcode UI. Then use the Editor menu.

在Xcode UI中选择项目文件。然后使用编辑器菜单。

Export:
Xcode > Menu Bar > Editor > Export For Localization...

导出:Xcode>菜单栏>编辑器>导出以进行本地化...

Import:
Xcode > Menu Bar > Editor > Import Localizations...

导入:Xcode>菜单栏>编辑器>导入本地化...

Xcode Menu > Editor > Import/Export


推荐阅读
author-avatar
flower_hj
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有