Search code examples
localizationxcode6xliffinfo-plist

Localize Info.plist with XLIFF in Xcode 6


Problem

I cannot figure out how to localize the NSLocationWhenInUseUsageDescription key. During export of the base language XLIFF file, Xcode automatically includes CFBundleDisplayName, CFBundleName, CFBundleShortVersionString, and NSHumanReadableCopyright. How can I include additional Info.plist keys? When I try to edit the strings files directly, the added keys are not included in future XLIFF exports.

Background

I am using the new base internationalization and localization tools in Xcode 6. With it, you no longer create or edit .strings files. Rather, choose "Export for Localization" from the "Editor" menu. Xcode will create an XLIFF file with strings from all nibs, code, and Info.plist. You then import a translated XLIFF, which then creates all strings files automatically, including InfoPlist.strings. See Localizing Your App from Apple's documentation.


Solution

  • You need to manually create an InfoPlist.strings file, and add it to the en.lproj folder in the project directory in the Finder. Then drag it into the Xcode project with the other InfoPlist.strings files without copying it.

    Please Note:

    • The InfoPlist.strings file will need to include the default keys and the keys you wish to add.
    • The file should NOT be added to base.lproj. This is reserved only for xib and storyboard related files.