Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should app extensions have their own Localizable.strings?

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?

like image 574
Stefan Arentz Avatar asked Dec 28 '25 02:12

Stefan Arentz


1 Answers

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).

like image 68
Schemetrical Avatar answered Dec 30 '25 15:12

Schemetrical



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!