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:
curl -u <your_key>: https://localise.biz/api/export/locale/en.strings > en.lproj/Localizable.strings curl -u <your_key>: https://localise.biz/api/export/locale/fr.strings > 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 as follows:
curl -u <your_key>: --data-binary @en.lproj/Localizable.xliff https://localise.biz/api/import/xliff?locale=source
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.
curl -u <your_key>: https://localise.biz/api/export/locale/fr.xliff?format=xcode > fr.lproj/Localizable.xliff
- See Importing XLIFF files
- See Exporting translations.
- 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 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.
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.