String catalogs from a Swift package Not loaded

I have encountered an issue related to the usage of string catalogs in a Swift package. I created a repository for reproduction.

https://github.com/atacan/DiscussionStringCatalogPackage

The Readme.md file has all the details. Here is a short summary:

The Package.swift file's target has resources: [.process("Resources")], and this Resources folder contains a string catalog. The catalog is correctly populated by the compiler, and German translations are added. Text view is using bundle: .module argument.

However, when the scheme run options are changed to German, the UI still displays English text. Xcode throws a warning indicating that the German translation for the text is not found in the Localizable table of the bundle and it says (not loaded). Although the bundle contains translations in the Localizable.strings file.

Screenshots of the issue are available in the original README file. I am looking for any insights or solutions to this problem.

Answered by Developer Tools Engineer in 783221022

This may be happening because the host app is not localized into German.

Try to add some strings to the host app as well and translate them in German.

Hello,

Thanks so much for the detailed project that reproduces the issue.

Could you add this to a feedback report so that we can route this to the appropriate team for further investigation?

Accepted Answer

This may be happening because the host app is not localized into German.

Try to add some strings to the host app as well and translate them in German.

You are right! I just added one text view to the app's target and now it works.

I don't put any new view or logic in my app target files normally. Everything is in the Swift libraries. I'll file a feedback to be able to do that with localization.

The repo is updated:

https://github.com/atacan/DiscussionStringCatalogPackage/tree/main?tab=readme-ov-file#scenario-three-the-swift-package-and-the-app-have-a-string-catalog-but-the-app-has-a-text-view-and-its-text-is-localized

String catalogs from a Swift package Not loaded
 
 
Q