If I create a swift package with 1000 strings in the Localizable.strings file for English, but I only end up using 10 of the strings in my app, will the other 990 strings be optimized away?
I am pretty sure that Localizable.strings files for languages not supported by the app are excluded, but I wanted to confirm whether Xcode is capable of detecting unused strings.
Hi, I suggest you take a look at the new String Catalog feature, which can detect unused (stale) strings:
https://developer.apple.com/wwdc23/10155
You can then remove all stale strings. There is no automatic optimization otherwise in .strings files.
If you have plurals like 3 pages, please check Stringdict or Plural Variants in String Catalogs. https://developer.apple.com/wwdc21/10221?time=1193
If you have plurals like My pages, please create 2 strings My page and My pages controlled by if/else. https://developer.apple.com/wwdc21/10221?time=1330
Concatenating (with +) is not recommended as it doesn’t let other languages reorder or change words.