TheJeff
TheJeff

Reputation: 4101

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.

Upvotes: 3

Views: 2472

Answers (2)

BB9z
BB9z

Reputation: 2720

Seems xcodebuild doesn't support auto export all localizations at this time.

But we can do it through Xcode interface.

Export menu in Xcode

Also it's possible auto select all localizations with a script. Read knownRegions section in project.pbxproj, loop to argument format.

Upvotes: 0

Mike Taverne
Mike Taverne

Reputation: 9352

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 

Upvotes: 7

Related Questions