Localizable Strings from a framework not shown in Widget

I have a in-house framework that I share between the main app and the widget.

The framework contains some localized strings.

These strings show up in correct language in the main app but on the widget they only show up in English.

I'm guessing the localized strings from the framework are not getting bundled in the widget extension.

Anybody with the same problem?
Answered by ekurutepe in 634777022
Answering my own question hoping it will help somebody else in the future:

Make sure you specify the bundle argument in NSLocalizedString. Otherwise it will default to Bundle.main. You need to use the bundle of your shared framework for the correct strings to be used.
Accepted Answer
Answering my own question hoping it will help somebody else in the future:

Make sure you specify the bundle argument in NSLocalizedString. Otherwise it will default to Bundle.main. You need to use the bundle of your shared framework for the correct strings to be used.
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.

Localizable Strings from a framework not shown in Widget
 
 
Q