Localization

RSS for tag

Localization is the process of adapting and translating your app to multiple languages.

Posts under Localization tag

122 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Issues with String Catalogs comments and git
Hello, I migrated a project to use String Catalogs (Localizable.xcstrings) instead of Localized.strings and Localized.stringsdict files. So far so good, but since I use a lot localized strings in my project, there are quite some localizations used more than once in different contexts and thus with different comments. For example: Source file 1: String(localized: "Something", comment: "Button title for context1") Source file 2: String(localized: "Something", comment: "Column title for context2") This results to a Localized.xcstrings file with this content: { "sourceLanguage" : "en", "strings" : { "Something" : { "comment" : "Column title for context2\nButton title for context1" } }, "version" : "1.0" } The main problem with this is, that the order of the concatenated comment changes randomly during each build. After the next Xcode build (without any code changes), the same Localized.xcstrings file might look like this: { "sourceLanguage" : "en", "strings" : { "Something" : { "comment" : "Button title for context1\nColumn title for context2" } }, "version" : "1.0" } This leads to false positives when trying to commit changes to a git repository, which is quite annoying. Am I the only one, having issues with comments in String Catalogs and git?
1
1
690
Dec ’23
How to localise Permissions Usage Description with String Catalog
Hey everyone, I have translated my app using the newest String Catalog feature but im wondering how can I translate the strings from the Target -> Info tab. I have read the string catalog documentation and searched on the internet but I can't find a recent post talking about it. I have found methods related to the info.plist file but afaik that would be legacy documentation as I can't even find a info.plist file in my project anymore. Also tried to look for posts talking about it here, but maybe I'm not using the right words as I couldn't find anything. I only found this article that mentions translating the strings from info but still couldn't see how to do it: https://developer.apple.com/documentation/bundleresources/information_property_list/managing_your_app_s_information_property_list#3375316 So if someone could help me out, it would be very appreciated, thanks. EDIT: I just followed the "creating a infoplist.strings" way and it worked, but im still wondering if there is a newer way to do it. I tried to just add a manual string in the string catalog using "NSContactsUsageDescription" as key but it didn't work
3
1
2.0k
Dec ’23
Unable to open dependencies file after Localization
Hi everyone, I'm currently working on a React Native app and need assistance with localization. Specifically, I've added an InfoPlist.strings file for NSUserTrackingUsageDescription and created language-specific files for each supported language. However, when I try to build the app in Xcode (version 15.0.1), I encounter the following error: error: unable to open dependencies file (/Users/myname/Library/Developer/Xcode/DerivedData/myproject-bxfjslkrewxnfcgmeelilvixy/Build/Intermediates.noindex/myproject.build/Debug-iphonesimulator/myproject.build/DerivedSources/Users/myname/projects/project-folder/ios/en.lproj/InfoPlist.strings.d) (in target 'myproject' from project 'myproject') Any insights or solutions would be greatly appreciated. Thank you!
1
0
793
Dec ’23
Website banner language issue
Hello everyone ! I currently experience an issue with the language of our website banners. Despite having translations set in Localizable Information for titles in English, French, German and Italian, the banners aren't adapting to the user's chosen language. The title always displays in French, while subtitle ("Open in the app") remains in English, irrespective of the user's language preference. Would anyone know how can I make sure that our banners dynamically translate according to the user's language choice? Is there a setting somewhere in the apple product page that I'm missing? Thanks
0
0
269
Jan ’24
Localization in Xcode info
I have now finished my app I am learning with for different translations in different localizations and have placed the strings in the StringCatalog. I still have one question about the localization: In my project info I have added the item Localization and added the value German. So far I have told the AppStore that the app language is German. Can I delete this localization item in the info now? Or what does this entry do (see screenshot)? Due to the different languages in the StringCatalog, I now have the languages of the StringCatalog in the project settings under Localizations. This is always followed by Resources 0 Files Localized. What is this all about?
0
0
320
Jan ’24
Localized iOS App - Obtain Device Language (not App Language)
I have an localized iOS App from which I want to obtain the device language (not the app language). The following sample app is localized in English and German. The current app language is German. Here I want to obtain english, since that's the device language (see next screenshot). Device Language Settings: App Language Settings: (shouldn't be considered for obtaining device language) Is there any API I could use to retrieve the device language? To obtain the device language is a product management requirement to derive next steps in the app localization process. Code of sample App: struct ContentView: View { var body: some View { Form { Text("Hello, world") Text("Locale.preferredLanguages:\n\(Locale.preferredLanguages.joined(separator: ", "))") Text("Locale.current:\n\(Locale.current.language.languageCode?.identifier ?? "")") } } } Note: I have asked this question on Stack Overflow too (see here)
3
0
509
Jan ’24
Locallized text not loaded/showed only on some device.
Hello. I have a strange issue with localized text. On some device (iPhone X with iOS 15.2.1 and iPhone 14 Pro with iOS 16.7.2) the localized isn't loaded and the UILabel is empty. In all the others UILabel in the view the localized text is correctly showed. It works perfectly on iPhone 8 with iOS 16.4.1, iPhone 8 with iOS 16.7 iPhone 12 with iOS 17.3, and also on iPhone 14 Pro 17.2 Simulator. Below the text from the localizable file: "m_alert_message" = "E' disponibile nello store la nuova App CAME Access. Vuoi iniziare la procedura per trasferire i dati di impianto nella nuova App?"; and how set the text property of the UILabel: messageLabel.text = NSLocalizedString("m_alert_message", comment: "") messageLabel.lineBreakMode = .byWordWrapping messageLabel.textAlignment = .center messageLabel.numberOfLines = 0 messageLabel.font = UIFont(name: XipAppearance.fontName, size: XipAppearance.fontSizeText) containerView.addSubview(messageLabel) Another strange thing is all other texts in all other views are correctly loaded and showed. Does anyone have any idea what the problem might be?
3
0
574
Feb ’24
app store doesnt display all languages, only english
Hi, There is 2 language selections for my app. One (German) is set as the primary, english secondary language. In app store connect there are correctly 2 languages listed. Now after publishing my app, I only see English. It should be English+1 (where German is also listed) or German+1 (where English is also listed). Why is it not recognized that I have 2 languages enabled?
0
0
303
Feb ’24
xcstrings file in not being updated
I'm using Xcode 15.2 and have migrated my (macOS) project to use an xcstrings file a while back. Now when I check the xcstrings file, all items are marked as "stale". When I add new localized strings in code, they don't show up in the xcstrings file. The xcstrings file is built correctly (into .lproj/Localizable.strings) when building. Where can I check which source files are checked to update xcstrings status? "xcstringstool" appears to have a "sync" feature which reads "stringsdata" files, but there is no information in the xcstringstool help on where the stringsdata files come from. If I create a new project I can see a "stringsdata" file being generated for each source file in the intermediate build products folder.
2
0
895
Feb ’24
Xcode + NSLocalizedString + String Catalogs + Macros
For quite a while, I have been using a somewhat simple-minded technique to provide semi-automatic localizations for strings used within a few of my apps. Here is the gist: Create an enumeration with RawValue of String that conforms to LocalizedRawRepresentable. Use this enum to associate a "key" with a string (default localization) Run a script that parses all Swift code looking for the enumerations that conform to LocalizedRawRepresentable and create/update a Localized.strings file. There were some minor issues, as it isn't easy to parse a complex Swift set of sources, but it got the job done. Simple example: enum L: String, LocalizedRawRepresentable { case fileNotFound = "File not found" } // [ ... ] if !FileManager.default.fileExists(at path: String) { print(L.fileNotFound.localized) } Well, we now have Xcode 15, and we have some new features: Macros - these things can parse Swift sources with excruciating detail A new ***** called String Catalogs Xcode supports these String Catalogs by automatically detecting localizations and creating, updating, and deleting entries into Strings Catalog automatically. So, it was time to update my simplistic LocalizedRawRepresentable and update it to support the String Catalogs! So, with my contrived example above, I spent quite a lot of time reading up and experimenting with the new Swift macros and created a macro that will make localizations much easier (so I thought...): @LocalizedStrings() enum L { private enum Strings: String { case fileNotFound = "File not found" } } The macro takes this modified enumeration and expands it to the following code: @LocalizedStrings() enum L { private enum Strings: String { case fileNotFound = "File not found" } static let fileNotFound = NSLocalizedString("fileNotFound", tableName: nil, bundle: .main, value: "File not found") } extension L: LocalizedStrings { } What I expected: Xcode would pick up the NSLocalizedStrings() generated code, and insert it into the strings catalog, and all of my work is done... no scripts needed! What I got... Xcode did not detect the generated code, and nothing was added, modified, or deleted from the strings catalog. So, I have a few questions: Is my code deficient in some way? Is there something I need to add to my generated code that would let Xcode know there are localizations to be detected? Is this an intentional limitation of Xcode's auto-detection of localizations for string catalogs to ignore generated code in its detection? (I'd hate to think I went through all this work for Xcode to simply ignore what I've done...!) Is this an accidental omission of Xcode that may be "fixed" in a future release? Right now, I can use the expanded macro to cut/paste the localization keys and values into the strings catalog, but I hoped that Swift macros plus Xcode auto-detection of localizations would have made this process nearly automatic. Does anybody have any suggestions?
2
0
798
Mar ’24
How to make app available in Monaco?
Hello, I have an app which is available only for some countries, including France. But people living in Monaco, needs to cross country border, to be able to install. Is it possible? I was pretty sure, Monaco is included in France (as AppStore country settings), but I have no way to check this. Same for San Marino - if Italy is enabled, San Marino citizens should be able to install without leaving their country?
1
0
422
Feb ’24
PKAddPassButton Localization on device language change
Lets say I got two preferred device languages( english first,italian second). I got a PKAddPassButton, which label gets the english localization on first install, but if I change the device language to Italian and relaunch the application, the buttons label has the english translation despite changing the first preffered device language to italian. I need to re install the application to get the italian string on the button. Is there anything I may be doing wrong?
0
0
451
Feb ’24
SwiftUI #Preview generate localizable strings in the Xcode String Catalog
Since Xcode 15.1, when compiling SwiftUI previews (using #Preview macro), strings that are unique to #Preview declarations are getting extracted and processed to the application's localizable strings catalog. In Xcode 15.0.1, this still works as expected and only UI strings from non-preview UI declarations are extracted and processed. Afaik, there is no setting for this in Xcode 15.1 and up. Anyone knows any other solution to avoid our catalog gets muddled with preview strings? I've already been reporting this via the Feedback hub since 15.1, but have had 0 responses from Apple on this.
0
1
402
Mar ’24
xcode 15 LS instead of LF in the xcloc files
Hi, I'm parsing iOS localization files and during tests with xcode 15 i noticed new lines appear in the xcloc files with LS instead of the usual LF i was used to. Questions: is this the default behavior in xcode 15? Has this changed with this version? is this controllable by any settings? Disclaimer: not a iOS developer here, please pardon any confusions and have patience.
2
0
409
Mar ’24
Composed string resources detected by Strings Catalog
I am using a string resource in the following way: let content = UNMutableNotificationContent() content.body = NSLocalizedString("notification_body_" + String(notificationBodyId), comment: "") And will have a number of strings defined in the strings catalog notification_body_1, notification_body_2 etc. This works fine, but the feature of strings catalogue that is automatically grepping source code for usage of strings is inserting an entry reality_check_notification_body_ that will obviously never be used & never be translated (thus showing my translated percentage at less than 100%). Xcode doesn't appear to provide a way for me to delete / ignore these automatically created string resources (delete button is disabled where available for manually created string resources). Is there some other way in code I should have referenced this resource, or some workaround to remove the string from strings catalog (no doubt if I manually remove from the backing file, it will simply be re-created). Thanks. Xcode 15.3
1
0
430
Mar ’24