Xcode 6 localization of plurals & genders with XLIFF

后端 未结 2 1594
迷失自我
迷失自我 2021-02-14 09:00

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?

As far as I underst

2条回答
  •  执念已碎
    2021-02-14 09:14

    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.

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

    A little more background on XLIFF and Xcode 6:

    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.

    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.

    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.

    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.

    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.

提交回复
热议问题