Export localisation since Xcode 11 will duplicate phrases?

For the same project, when I exported localisation using Xcode 11 or 12, it results in almost duplicates of phrases compared to Xcode 10. By checking Xliff in an editor, it shows the same phrase in two different locations.

e.g. I have a phrase key of "Today"
It shows in two locations
1) en.lproj/Common.strings <- New one
2) {Project}/en.lproj/Common.strings

Is there a tutorial or documentation that shows the proper way of setting up localization in a multi-target (main app and extensions) environment?

Replies

I think this comment could help you
https://developer.apple.com/forums/thread/661201?answerId=635229022#635229022

The best-practice we recommend here is:

  1. Have your framework export a new macro / function ex: FWLocalizedString that calls NSLocalizedStringFromTableInBundle (Objective-C) or the sets the bundle argument in NSLocalizedString (Swift) to your framework bundle

  2. Use FWLocalizedString for all localized strings within your framework

  3. In your framework target, add FWLocalizedString to the "Localized String Macro Names" build setting

Now, when you export for localization all FWLocalizedString calls will be extracted in the framework target—but not from the application or widget target.
I would invite you to file a feedback about this.
I tested again, the issue is about multiple targets instead of frameworks (although I wanted to ask something about internal frameworks too)

I am adopting Mac Catalyst in our project. For reasons to include different frameworks between iOS and macOS apps, I setup one target for each. So this is where the issue starts...

1) Main app (iOS) exports to {Project}/en.lproj/Common.strings
2) Mac Catalyst exports to en.lproj/Common.strings

I confirmed by removing the Mac Catalyst target to export.