Xcode 6复数&的本地化XLIFF的性别 [英] Xcode 6 localization of plurals & genders with XLIFF

查看:71
本文介绍了Xcode 6复数&的本地化XLIFF的性别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode 6中,XLIFF文件格式现在用于字符串的本地化.但是,我需要对复数形式和性别进行本地化.如何在Xcode 6中做到这一点?

In Xcode 6 the XLIFF file format is now used for localization of strings. However, I need localise plurals and genders. How can I do this in Xcode 6?

据我了解,XLIFF文件现在替换了Localizable.strings文件.在iOS 7/OS X 10.9中,我们可以对复数&通过添加Localizable. stringsdict 来设置性别.但这需要存在Localizable.strings.但是,由于现在没有Localisable.strings文件,如何使Localizable.stringsdict文件起作用?

As far as I understand, the XLIFF file now replaces the Localizable.strings file. In iOS 7/ OS X 10.9 we could localise plurals & genders by adding Localizable.stringsdict but this requires a Localizable.strings to exist. But since now there is no Localisable.strings file, how can I get the Localizable.stringsdict file to work?

推荐答案

从Xcode 6开始,Apple使用XLIFF作为导出项目进行本地化的文件格式.但是,项目内部没有任何变化.您应该继续使用Localisable.strings和Localizable.stringsdict文件来处理

As of Xcode 6, Apple uses XLIFF as the file format for exporting your project for localization. However, nothing has changed inside the project itself. You should continue using Localisable.strings and Localizable.stringsdict files to handle plurals per Apple's documentation on Handling Noun Plurals and Units of Measurement.

您可以引用此 Objective-C项目或此

You can refer to this Objective-C project or this Swift project as examples of using strings dictionary files for plurals with Xcode 6.

有关XLIFF和Xcode 6的更多背景知识:

A little more background on XLIFF and Xcode 6:

XLIFF(XML本地化交换文件格式)是一种基于XML的格式,用于在本地化过程中标准化可本地化数据在工具之间传递的方式. XLIFF在2002年被OASIS标准化.

XLIFF (XML Localisation Interchange File Format) is an XML-based format created to standardize the way localizable data are passed between tools during a localization process. XLIFF was standardized by OASIS in 2002.

当您单击Xco​​de中的Editor-> Export for Localization时,它将所有可本地化的资产打包到一个XLIFF文件中,可以将其交给翻译人员处理,以对应用程序的字符串进行本地化.由于XLIFF是一种标准的文件格式,因此这意味着翻译人员和翻译工具无需了解Apple的内部字符串格式.

When you click on Editor -> Export for Localization in Xcode, it packages up all of your localizable assets into an XLIFF file that can be handled off to translators for localizing your application's strings. Since XLIFF is a standardized file format, this means translators and translation tools do not need to understand Apple's internal strings format.

这是一个结果示例通过导出上面引用的 Swift生成的XLIFF 文档项目进行本地化.现在,翻译人员可以使用翻译平台或工具来翻译应用程序的内容,并返回给您本地化的XLIFF文件.然后,作为开发人员,您可以使用Xcode的导入本地化"功能将转换后的XLIFF文件导入到您的项目中.这将导致Xcode从导入的XLIFF生成必要的特定于语言环境的字符串文件.

Here's an example of the resulting XLIFF document produced by exporting the above referenced Swift project for localization. Now translators can use a translation platform or tool to translate your application's content and return to you a localized XLIFF file. You, as a developer, can then use Xcode's "Import Localizations" feature to import the translated XLIFF file into your project. This will cause Xcode to generate the necessary locale specific strings files from the imported XLIFF.

简而言之,您开发项目的方式没有任何改变. Xcode 6中添加的是一项新功能,可以简化本地化过程.

In short, nothing has changed in how you develop your project. What's been added in Xcode 6 is a new feature to simplify the localization process.

关于复数形式和针对本地化的出口,我应该提一个警告.从Xcode 6.1开始,Apple的本地化导出功能仍然缺少正确导出复数形式的方法.这很可能是由于当前的XLIFF规范不具有管理字符串的多个表示形式的标准化方法.苹果公司有一个打开错误与苹果公司有关.

There's one caveat that I should mention though about plurals and exporting for localization. As of Xcode 6.1, Apple's export for localization feature still lacks a way to properly export plurals. This is most likely due to the current XLIFF spec having no standardized way of managing plural representations of a string. There's an open bug with Apple to address this issue.

这篇关于Xcode 6复数&的本地化XLIFF的性别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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