Search code examples
iosxcodelocalizationxcodebuild

Export all localizations on the command line in Xcode


I have 26 languages successfully localized and tested. I am able to successfully export all 26 localizations with option: "Editor" -> "Export for Localization...", then selecting all of them.

However, when I use the following xcodebuild command, it exports my default language "en", and nothing else.

xcodebuild -exportLocalizations -localizationPath TempLocalizationExport

How do I export all twenty-six Localizations rather than just "en"?

There are no command line errors outputted from the command.

I've seached everywhere for official xcodebuild commandline command documentation on developer.apple.com, and I can't find a verbose and helpful source that addresses additional -exportLocalizations options and standard behavior.


Solution

  • According to the docs:

    To export localizations, enter this command in Terminal, replacing the dirpath and projectname arguments:

    xcodebuild -exportLocalizations -localizationPath <dirpath> -project <projectname> [[-exportLanguage <targetlanguage>]]
    

    The exported XLIFF files are placed in dirpath. Optionally, use the exportLanguage argument to export other localizations.

    UPDATE:

    The OP discovered that multiple languages can be exported by repeating the -exportLanguage argument. For example, this command exports two languages:

    xcodebuild -exportLocalizations -localizationPath TempLocalizationExport -exportLanguage es -exportLanguage ru