Loco support for iOS strings files and Xcode localizations
The simplest workflow is to manage your strings files directly. Once you've imported your strings, you can translate them within Loco and pull them into your Xcode build whenever you need to update it.
For example: A simple Terminal command using
curl is all you need to save your strings file directly into your Xcode project:
wget https://localise.biz/api/export/locale/en.strings?key=<KEY>` -O en.lproj/Localizable.strings wget https://localise.biz/api/export/locale/fr.strings?key=<KEY>` -O fr.lproj/Localizable.strings
- See the export API for more detail on how to automate the export of your strings files.
- If you have multiple strings files, you may wish to tag your assets or manage them as separate projects.
Xcode's "Export for Localization..." option creates an English
en.xliff file which can be imported into Loco for translation.
To export the localized XLIFF file you should specify Loco's iOS-specific XLIFF format. You can then import this file using Xcode's "Import Localization..." option
The following Terminal example shows the xcode parameter being specified instead of the generic XLIFF export.
- See Exporting translations for more detail on how to export XLIFF files.
- See Apple's documentation on working with XLIFF files.
Plurals are managed in the main Loco interface the same way for all platforms, but managing plural forms into Xcode has been changing over the years. Loco provides a number of ways to work with iOS plural forms.
If you're using a custom library such as
TTTLocalizedPluralStringto handle plurals, just name your Loco assets appropriately and export
.stringsfiles directly into your Xcode project.
If you're using Foundation's plural support (as of iOS 7) you can export a
Localizable.stringsdictfile from Loco which contains only the pluralized strings in your project. This is generally used if you're exporting
As of Xcode 9, XLIFF files have a
<file>section corresponding to
.stringsdictdefinitions. Loco can import and export plural rules embedded in XLIFF.