Discover String Catalogs

RSS for tag

Discuss the WWDC23 Session Discover String Catalogs

Posts under wwdc2023-10155 tag

20 Posts

Post

Replies

Boosts

Views

Activity

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. 😔
9
0
6k
Jan ’25
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
2.7k
May ’24
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
820
Aug ’23
Missing string catalog
I have an App with multiple string catalogs. I mistyped the name of a table in one of my String(localized: "Some English Text", table "nonExistingTable") instances. I did not receive a compile-time warning telling me the table was missing and my application defaulted to the English text instead. Is this expected behaviour or a bug?
1
0
1.1k
Aug ’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
3.2k
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
1.1k
Aug ’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
1.3k
Jul ’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
1.2k
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
1.5k
Jul ’23
Mulitple Targets with shared Localizable file. Cannot convert to String Catalog
In my project I have 3 targets. A macOS target, a target for iPhone and a target for iPad. The macOS App has an own Localizable file and I have been able to convert this to string catalog without any issues. I like this catalog! But when I try to convert the Localizable file that is shared between 2 targets, then targets fail to compile afterwards with the following error message: ...mul.lproj/Localizable.xcstrings:1:1 Localizable.xcstrings cannot co-exist with other .strings or .stringsdict tables with the same name. Does anybody have an idea how I can resolve this? Do I need to keep individual copies of the Localizable file for these 2 targets?
1
0
2.2k
Jun ’23
String Catalogs won't import translated .xliff
We use a localization service that allows us to export our translated strings in .xliff format. When I import the spanish (es.xliff) file into the string catalogs it imports the english keys and leaves the spanish translation column empty, which causes it to default to English. I created feedback 12429535 and 12429469 because it seems the feedback site is broken and shows it cannot find the feedback I just submitted.
0
0
929
Jun ’23
Xcode 15.0 Beta: String Catalog is not syncing with code in a Static Library
Seems like a bug on the Xcode 15.0 beta. Steps to reproduce: Create a new empty Static Library project in Xcode (objective-C) Add a String Catalog file Add a dummy function which includes NSString *str = NSLocalizeString(@"test string", @"comment"); Build the project. Result: String Catalog is empty while it should be updated with "test string". I submitted FB12408229 Anyone encountered this? Anyone from Apple can kindly confirm?
0
0
934
Jun ’23
Migration experience to strings catalog
Migrating from localizable.strings to string catalog is simple. After migrating the state of 55% are checked okay, 45% are marked with state "new". Why happens this? Reviewing the new strings and marking as "reviewed" would now mean to change each of the 60 "new" marked rows x 4 languages manually - a lot of work. Is there a way to group change the states of all strings?
1
0
1.5k
Jun ’23
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. 😔
Replies
9
Boosts
0
Views
6k
Activity
Jan ’25
Merge or Split a String Catalog
Is it possible to merge or split a string catalog? It doesn't seem possible now. The workaround i use now is eidting the xcstrings file in TextEdit.
Replies
5
Boosts
0
Views
1.8k
Activity
Nov ’24
Mark localized strings untranslatable
String catalog is a great new feature to organize strings in one place. What would you recommend how to handle extracted Strings which need not be translated in different languages
Replies
7
Boosts
0
Views
4.9k
Activity
Jul ’24
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!
Replies
2
Boosts
1
Views
2.7k
Activity
May ’24
How do I ask the compiler to ignore strings from External frameworks?
When the "Use compiler to Extract Swift Strings" is set to true, it extracts strings from the frameworks i have imported as well. How can i avoid this?
Replies
1
Boosts
0
Views
1k
Activity
Sep ’23
Localized Screenshots
Hi, still without any success I can’t recreate the ui tests that will highlights the string in the screenshot like it’s shown in WWDC 2019 - 403. I even submitted feedback via Feedback Assistant 3 months ago. FB12284285 https://developer.apple.com/videos/play/wwdc2019/403/ I would love to see this finally works with string catalogs. Thanks
Replies
0
Boosts
0
Views
722
Activity
Sep ’23
Custom Localized String Macro Names build setting for Swift.
Why is the custom localized string macro name only allowed for Objective C and C code? I have a wrapper class for localization which is a Swift function. I'm unable to get the strings i pass to it localized. Is there any way to get it working other than writing an objective C class and adding it to the bridging header?
Replies
1
Boosts
0
Views
1.8k
Activity
Sep ’23
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
Replies
0
Boosts
0
Views
820
Activity
Aug ’23
Missing string catalog
I have an App with multiple string catalogs. I mistyped the name of a table in one of my String(localized: "Some English Text", table "nonExistingTable") instances. I did not receive a compile-time warning telling me the table was missing and my application defaulted to the English text instead. Is this expected behaviour or a bug?
Replies
1
Boosts
0
Views
1.1k
Activity
Aug ’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?
Replies
3
Boosts
0
Views
3.2k
Activity
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.
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’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?
Replies
1
Boosts
1
Views
1.3k
Activity
Jul ’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?
Replies
3
Boosts
0
Views
1.2k
Activity
Jul ’23
Unable to remove/delete a language
When adding a new language I added something I don't intend on supporting however you are unable to delete an added language once added. Yes, I could edit the file as source code and remove all the e.g. de-DE references but that shouldn't be needed. Edit: Submitted this as feedback via FB12576340
Replies
1
Boosts
0
Views
1k
Activity
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
Replies
2
Boosts
0
Views
1.5k
Activity
Jul ’23
How to export only select strings from a string catalog?
I have a string catalog of over a 1000 strings. How do i export only the strings that need to be reviewed and not the whole catalog?
Replies
1
Boosts
0
Views
1k
Activity
Jun ’23
Mulitple Targets with shared Localizable file. Cannot convert to String Catalog
In my project I have 3 targets. A macOS target, a target for iPhone and a target for iPad. The macOS App has an own Localizable file and I have been able to convert this to string catalog without any issues. I like this catalog! But when I try to convert the Localizable file that is shared between 2 targets, then targets fail to compile afterwards with the following error message: ...mul.lproj/Localizable.xcstrings:1:1 Localizable.xcstrings cannot co-exist with other .strings or .stringsdict tables with the same name. Does anybody have an idea how I can resolve this? Do I need to keep individual copies of the Localizable file for these 2 targets?
Replies
1
Boosts
0
Views
2.2k
Activity
Jun ’23
String Catalogs won't import translated .xliff
We use a localization service that allows us to export our translated strings in .xliff format. When I import the spanish (es.xliff) file into the string catalogs it imports the english keys and leaves the spanish translation column empty, which causes it to default to English. I created feedback 12429535 and 12429469 because it seems the feedback site is broken and shows it cannot find the feedback I just submitted.
Replies
0
Boosts
0
Views
929
Activity
Jun ’23
Xcode 15.0 Beta: String Catalog is not syncing with code in a Static Library
Seems like a bug on the Xcode 15.0 beta. Steps to reproduce: Create a new empty Static Library project in Xcode (objective-C) Add a String Catalog file Add a dummy function which includes NSString *str = NSLocalizeString(@"test string", @"comment"); Build the project. Result: String Catalog is empty while it should be updated with "test string". I submitted FB12408229 Anyone encountered this? Anyone from Apple can kindly confirm?
Replies
0
Boosts
0
Views
934
Activity
Jun ’23
Migration experience to strings catalog
Migrating from localizable.strings to string catalog is simple. After migrating the state of 55% are checked okay, 45% are marked with state "new". Why happens this? Reviewing the new strings and marking as "reviewed" would now mean to change each of the 60 "new" marked rows x 4 languages manually - a lot of work. Is there a way to group change the states of all strings?
Replies
1
Boosts
0
Views
1.5k
Activity
Jun ’23