Localizing push notification alert messages with String Catalogs

Our app is not localized but we want to begin the localization process starting with push notifications we are going to integrate. The documentation notes:

you can store your message strings in the Localizable.strings file of your app bundle and use the title-loc-key, subtitle-loc-key, and loc-key payload keys to specify which strings you want to display

String Catalogs in Xcode 15 supersedes Localizable.strings. How do you support this when using String Catalogs? Do you just manually add a Localizable.xcstrings file to your project then manually add a new entry for your loc-key, and the system will find this string without issue? Or will we need to have a Localizable.strings file too?

Accepted Reply

Yes, because String Catalogs build to .strings files, you can add a Localizable.xcstrings string catalog to your target and then manually add a new entry for your loc-key. The notification infrastructure will pick up the value of loc-key at runtime from the built .strings file.

Replies

Yes, because String Catalogs build to .strings files, you can add a Localizable.xcstrings string catalog to your target and then manually add a new entry for your loc-key. The notification infrastructure will pick up the value of loc-key at runtime from the built .strings file.

@Frameworks Engineer Is there any way I can see the generated_ .strings_ file (and .stringsdict) from .xcstrings?

I'd like to move to Strings Catalog, but I have a script running in build phases that parses legacy .strings files (and I would not like to update the parser to read .xcstrings format)

I tried this with a loc-key and title-loc-key and I only see the keys in the notification. The localization values aren't presented and they used to work before the migration. Is this a know issue or is anyone else experiencing this and if there's a solution. @Frameworks Engineer

  • Same problem here, it worked well before, but now that I'm using Strings Catalog the notification displays title key and not the translated version.

Add a Comment