Discover String Catalogs

RSS for tag

Discuss the WWDC23 Session Discover String Catalogs

Posts under wwdc2023-10155 tag

14 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Swift can't read the textDocumentProxy.documentContextBeforeInput after entering a newline
I am typing string text on textDocumentProxy in a custom keyboard app. The input text includes newlines and punctuation letters, but when I try to edit the textDocumentProxy field, the textDocumentProxy.documentContextBeforeInput in case a newline \n is included, it does not return full content before input. I placed the cursor on after the good morning word center, I got only good string text. The remaining "hi folks", words do not return. Here are some examples I have tried. var inputText = "Hi folks, Good morning to everyone " var txtBeforeCursor = textDocumentProxy.documentContextBeforeInput ?? "" print("Before Cursor text : ",txtBeforeCursor) Output is: Before Cursor text : Good
0
0
554
Aug ’23
How to use String Catalogs using a fallback language?
I have English as the base language but I also support English (UK) which defines a few UK specific localizations but should fall back to English for everything else. The way I have it now, all my fallback strings are in "New" state in the UK localization, ie they don't have a UK specific string. This actually works, but UK completion is at 5% and I can't find a way to tell it that the rest are OK to be taken from the base language. By keeping a lot of "New" strings, the tool won't be helping me when I add more strings to the base language. Marking those as Reviewed creates a blank string localization which is obviously not what I need. BTW if marking as reviewed would help here, it would be a pain because it has to be done one by one, I can't multi select.
0
0
719
Aug ’23
How to translate dynamic text with String Catalog
My app has the Text views that display the value of variables. Below are two sample pieces of code and the String Catalog (Localizable.xcstrings) entries created when app builds: (1) Code: Text("[ (var1) ]") Key: [ %@ ] Default: [ %@ ] Spanish: [ %@ ] (2) Code: Text("(var2) - (var3) - (var4)") Key: %@ / %@ / %@ Default: %1$@ / %2$@ / %3$@ Spanish: %1$@ / %2$@ / %3$@ Each of the 4 vars have a discrete number of known possible values. How do I enter the possible var values and their associated Spanish translations in the String Catalog?
3
0
776
Jul ’23
String Catalog does not work with deployed App
I migrated to String Catalog in my app. That worked fine, and everything is OK in the Simulator and even on a real device. However, After I deployed the App and it became available in the AppStore, I started receiving Feedback from some users. Seems my app is no longer doing localization. It always presents itself in its development language. Has anyone else experienced this?
1
1
968
Jul ’23
String dicts and notification localization
Hi, I've been using string files to localize incoming remote notifications like this: "training_new_title" = "New training added"; "training_new_body" = "A new training on %@ has been added"; Following the migration to the new string dicts it looks like this: "training_new_body" : { "extractionState" : "manual", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", "value" : "A new training on %@ has been added" } }, "nl" : { "stringUnit" : { "state" : "translated", "value" : "Een nieuwe training op %@ is toegevoegd" } } } }, "training_new_title" : { "extractionState" : "manual", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", "value" : "New training added" } }, "nl" : { "stringUnit" : { "state" : "translated", "value" : "Nieuwe training toegevoegd" } } } }, Unfortunately as said before notifications are no longer localized and come in as their normal state: "training_new_title" & "training_new_body" . I am using Firebase messaging service, they send a APNS, that looks like this: notification: { titleLocKey: "training_new_title", bodyLocKey: "training_new_body", bodyLocArgs: bodyPayload, } Do string dicts require any extra steps apart from the standard that I have implemented? func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { completionHandler(.newData) } Thanks in advance for any insights
2
0
997
Jul ’23
Xcode 15 beta strings catalog
Hey, I'm trying the new strings catalog, and I have a script that I would like to run on the xcstrings json. My question is there some documentation on the json format (what keys can it have, and values)? Also, I didn't try it yet, but what if I set for example 50 languages and 1000 localization keys, is that json really scalable? It could grow quite large, would xcode still keep it as one big file, or it would somehow split it into chunks? Would be happy for any info from the dev teams, thanks!
2
1
1.4k
May ’24
Are Swift Packages supported by String Catalogs?
Hello, do the String Catalogs (new in Xcode 15) support Swift Packages? I've tried adding a new Localizable.xcstrings (string catalog) file to my package's resources folder. Great! I then see this screen: All good so far. I then try to go and build my Swift Package... and nothing changes. The string catalog is never populated and I'm left with the same screen as above. So, do string catalogs not support packages at this time or am I doing something wrong? I was really hoping String Catalogs would work and save the day since Export Localizations also does not work for Swift packages that don't support macOS. 😔
7
0
3.2k
Dec ’23
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?
3
0
1.8k
Aug ’23