3

Currently using Xcode 6.3

In our (open source) application we have two targets:

  • Our main application 'Client'
  • An action extension 'ShareTo'

Both targets have localized strings via NSLocalizedString().

When I "Export for Localization", I see one <file> extension in the exported XLIFF file named Client/Localizable.strings that contains the strings for both the main application and the app extension.

Same results when doing an export from the command line via xcodebuild.

I am very sure that this export behavior changed over time: previously the strings from the app extension would end up in a separate Extensions/ShareTo/Localizable.strings entry in the XLIFF file. Not combined in Client/Localizable.strings.

So now I am wondering, is this new and correct behavior? Does this mean that app extensions lookup strings in their parent's bundle?

Stefan Arentz
  • 34,311
  • 8
  • 67
  • 88

1 Answers1

2

It really doesn't matter. If Xcode likes one, then you can concat both files together.
In larger projects, instead of one Localizable.strings, we would use multiple .strings file, one for each class or one for each class assigned for a particular class using NSLocalizedStringFromTable();
Just make sure that the strings file is copied to both bundles (check the file inspector, right sidebar first tab).

Schemetrical
  • 5,506
  • 2
  • 26
  • 43
  • Thanks for your answer. Adding the single `Client/Localizable.strings` to both targets is a workaround but not really a solution IMO. – Stefan Arentz Apr 11 '15 at 13:06
  • @StefanArentz you can always split it up if you don't like it and use `NSLocalizedStringFromTable();`. Its not a workaround, many cases, strings are shared between targets because many of the strings are the same. – Schemetrical Apr 11 '15 at 13:10