Localization

RSS for tag

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

Posts under Localization tag

93 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Default localization fallback not used for untranslated string in catalog
For an iOS app, I'm using a String Catalog for localization. In the Localizable.xcstrings, I have all the Keys set with IDs, and default to English set, and other languages added. All of the English strings has some English text value assigned. The Key and the values are different. The Swift code only makes references to the Keys. As for the non-English languages, not all of the strings have been translated. Many of the fields are not set, i.e. it's in grey and showing the English text, and I can see the "new" tags for those untranslated strings in the String Catalog. All of that is good and expected. However, when I run the app in a non-English language, for the untranslated strings, I'm seeing the string Key instead of the English value. The screens in the app are shows Key IDs all over the place, along with some translated text, but nothing in default English. Is that how it's suppose to work? It seems like the "Default Localization (en)" should be shown. That's the whole point of having a fallback default language is it not? I understand pre-string catalogs, the fall back default is the key, but now I'd expect it to use the default language as backup since that's what's shown in the catalog.
4
1
1.1k
Sep ’24
Package.resolved discrepency
We are using a workspace file and have noticed that when we run fastlane commands that utilize xcodebuild command line arguments to run the export localization command from commandline, and it seems that it uses the xcodeproj package.resolved instead of the workspace package.resolved. This is causing issues as the xcodeproj package resolved will not update at all so is on old version of dependencies that cause xcodebuild commands to fail. Why is there multiple package.resolved files and why does the xcodeproj not stay updated with what is in the workspace resolved file? Why won't the xcodeproj resolved file update when I'm opening the xcodeproj file and selecting specific dependencies and telling it to update the package.
0
0
344
Sep ’24
JSONEncoder: How to sort keys using "localizedStandardCompare"? (just like how Xcode 16 serialize a xcstrings file)
Hello, I'd like to ask a very fundamental question about JSONEncoder: how to sort keys in a specific order when encoding a dictionary to JSON text? I know there is an option called JSONEncoder.OutputFormatting.sortedKeys, but it sorts the keys only in lexicographic order. I want to sort the keys using a different comparator, such as String.localizedStandardCompare(_:), which achieves the "Finder-like" order. The reason why I ask this question is because I have a localization tool that works with String Catalog (xcstrings file, which is a JSON), but every time my tool serializes an xcstrings file, it always messes up the keys in lexicographic order (I used JSONEncoder + .sortedKeys). Meanwhile, Xcode 16 always serializes the string keys into the "Finder-like" order. As a result, my tool always generates a huge diff when manipulating the xcstrings even when making only a small modification to it. So I am wondering how Xcode 16 implements the String Catalog tool to serialize the JSON in "Finder-like" order. It would be great if JSONEncoder could do that too. Or, maybe I can use another serialization method to implement this behavior?
4
0
995
Sep ’24
String catalog and local package
Hello Apple community ! I'm facing an issue regarding xcstrings in a local package in my project. It's an iOS application with a local package containing multiple targets. The Localizable.xcstrings is located in the app target and contains keys for the app and targets of the local package (Views in the targets look for keys in the main bundle) My issue is that auto detection/extraction seems to work only for keys used inside the app bundle. It doesn't look in the package. However, if I add a Localizable.xcstrings inside a package target, it gets populated. Is this normal behaviour & is there any way to make extraction put the keys in the main bundle xcstrings instead ? I feel like it should be normal behaviour if no xcstrings is found in the package My fallback would be to set all keys in manual extraction state but it's not ideal ;) Thanks in advance for the great work Eric
1
0
766
Sep ’24
Issues with Displaying Language Tags Compliant with RFC 5646
Hello, I'm currently facing some issues with localization for the Safari extension on iOS: Issues with Language Tags: Folder names like pt-BR (Brazilian Portuguese) and pt-PT (European Portuguese) placed in the Resources/_locales/ directory are not displaying the respective languages correctly; instead, the default English is shown. Similarly, using folder names like zh-CN (Simplified Chinese) and zh-TW (Traditional Chinese) also results in default English display instead of the intended Chinese language. Conversely, when changing the folder names to pt (Portuguese general) and zh (Chinese general), the languages display correctly. Could you please provide any recommendations or tips regarding language tag settings and how to ensure they are properly recognized according to RFC 5646? Thanks for your help! Best,
5
0
1.4k
Oct ’24
String Catalog on separate Package
I'm creating a new app, following String catalogs,  But, after start creating separate packages per feature, I found that I have to start typing String(localized: "Test", bundle: .module) To not loose the functionality of auto sync with the catalog, and work with the module. Would be really great if as it is on a separated module, work automatically within the file in the module. Do someone knows if I'm missing something ? Thanks
1
0
478
Aug ’24
"Add to Apple Wallet" (PKAddPassButton) title localization to device language
Hi there! My app supports one language by default Ukrainian (uk) and does not support multiple languages. In Xcode settings "Development Language" is set to Ukrainian by default also. I have a PKAddPassButton on a ViewController and "Add to Apple Wallet" always appears in Ukrainian (Tested on real device iOS 15/16/17). Apple's "Getting Started with Apple Pay: In-App Provisioning, Verification, Security, and Wallet Extensions” document states that "The Add to Apple Wallet button adapts to the device language and the light and dark appearances, but the issuer app needs to adapt the language of the row selector text." When I change device language to French the “Add to Apple Wallet” button does not change to French. I created a fresh swift app, added PKAddPassButton the "Add to Apple Wallet" button, General -> Language & Region changed the device language to French, etc, but the "Add to Apple Wallet" button is always in English. Has anyone run into the same issue? How to adapt the "Add to Apple Wallet" button to the device system language?
2
0
1.3k
Aug ’24
Incorrect `NSLocationWhenInUseUsageDescription` is displayed from InfoPlist.xcstrings when default localization key/value has a `state` of `new`
en.lproj/InfoPlist.strings ja.lproj/InfoPlist.strings (I resolved this issue but I still consider it a bug in Xcode. Hopefully any other poor soul that encounters it will find this post.) Summary When App default localization is e.g. Japanese Secondary localization is e.g. English InfoPlist.xcstrings is added to the target NSLocationWhenInUseUsageDescription is added in Japanese to Info.plist (within target build settings). NSLocationWhenInUseUsageDescription is localized to English CLLocationManager().requestWhenInUseAuthorization() is called Then If device language is English: NSLocationWhenInUseUsageDescription is displayed in English on the location permission system dialog (correct behavior). If device language is Japanese: NSLocationWhenInUseUsageDescription is displayed in English on the location permission system dialog (incorrect behavior). Expected behavior If device language is Japanese: NSLocationWhenInUseUsageDescription should be displayed in Japanese on the location permission system dialog. Root cause The json representation of InfoPlist.xcstrings is the following after following the above procedure: { "sourceLanguage" : "ja", "strings" : { "NSLocationWhenInUseUsageDescription" : { "comment" : "Privacy - Location When In Use Usage Description", "extractionState" : "extracted_with_value", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", "value" : "test" } }, "ja" : { "stringUnit" : { "state" : "new", "value" : "テスト" } } } } }, "version" : "1.0" } After building, Xcode creates the key NSLocationWhenInUseUsageDescription.ja.stringUnit.state with the value new, and the value as テスト (the automatically extracted value from Info.plist). At runtime, iOS ignores ja.stringUnit.value and falls back to en.stringUnit.value when: NSLocationWhenInUseUsageDescription.localizations.ja.stringUnit.state == "new" NSLocationWhenInUseUsageDescription.extractionState == "extracted_with_value" Additionally, Xcode's "String Catalog" interface for xcstrings files does not show the new state value in the interface and does not allow ja.stringUnit.value to be modified. Fixes/Workarounds Option 1 Open InfoPlist.xcstrings in string catalog mode. Right click the entry in the source language. Click "Mark as Reviewed". Option 2 Open InfoPlist.xcstrings in source mode. Change all {sourceLanguage}.stringUnit.state values from new to translated. Option 3 Remove NSLocationWhenInUseUsageDescription key from Info.plist or build settings. Add NSLocationWhenInUseUsageDescription key manually to InfoPlist.xcstrings. Fill in values for source language and other languages. Note: {key}.extractionState for this case will be manual instead of extracted_with_value. Option 4 Use older/deprecated InfoPlist.strings files instead of .xcstrings. InfoPlist.xcstrings after fix { "sourceLanguage" : "ja", "strings" : { "NSLocationWhenInUseUsageDescription" : { "comment" : "Privacy - Location When In Use Usage Description", "extractionState" : "extracted_with_value", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", "value" : "test" } }, "ja" : { "stringUnit" : { "state" : "translated", "value" : "テスト" } } } } }, "version" : "1.0" } Reproduceable Environment Xcode 15.4 / iOS 17.5 Xcode 16 beta 5 / iOS 18 Simulator Device Screenshot of bug "test" should be "テスト".
1
0
929
Aug ’24
Localise - Seperate screenshot for my primary location?
Hi Guys, I want to localise my app store product page. I want to have a default set of images for all product pages and for my primary location (Australia), I want my primary image to be different. I want to show that it is Australian-made. by default your primary location becomes your default for all other images and I don't want the same screenshot in all other stores (US, UK,JPN etc) Any ideas?
0
0
426
Aug ’24
Localization of App Using String Catalogs - Storyboard
Hi everyone! I want to localize my swift application, which uses Storyboard, using String Catalogs. I have watched several tutorial videos about localization, however, it uses SwiftUI. I have tried localizing my storyboard through .string and migrating it to String Catalogs and it worked. (Example codes are attached below) But in the tutorials, String Catalogs extraction works when you build the project. But if you are using storyboard, I think it is not possible? or are there any other ways to extract the strings from storyboard using string catalogs directly and not using .strings and migration? This also makes me wonder if the Vary by Plural will work with the method that I did. Thank you so much in advance! Have a nice day ahead! Sample Codes from .strings (storyboard): /* Class = "UITextField"; placeholder = "Enter Password"; ObjectID = "08D-xr-4ke"; */ "08D-xr-4ke.placeholder" = "Enter Password"; /* Class = "UIButton"; configuration.title = "Login"; ObjectID = "2gQ-cX-5nH"; */ "2gQ-cX-5nH.configuration.title" = "Login"; Migrating it to String Catalogs: key : 08D-xr-4ke.placeholder English(en): Enter Password comment: /* Class = "UIButton"; configuration.title = "Login"; ObjectID = "2gQ-cX-5nH"; */
1
1
1.1k
Aug ’24
How to fix languages in App Store
I just put my app on the store for pre-order. I wanted to localize it to Spanish (don't ask me why 😅), so it should be supporting English (primary language) and Spanish. However, on the App Store, it thinks that my app only supports Spanish. How do I fix this in App Store Connect (or wherever it should be fixed)? Thank you so much for the help!
5
0
1.1k
Aug ’24
Localization Glitch
I've mentioned this before but I don't think it's getting seen by a department that can deal with it. I think it may be a Connect issue. I have localizations in multiple languages. They are all created the same way. In that the images are the same as the default language. I tried to rely on icons rather than text wherever possible to keep language from being a limiting factor. Since releasing the app, I've tried a few ways to advertise it. One being ASA (Apple Search Ads) Basic. It accepts all my localizations except for Brazil. Even accepts Portugal. When I email ASA tech support, I get generic sounding replies that are some variation of "add localization for Brazil and then the ads will start running". They do seem to acknowledge the text localization is there but seem to believe the images are not. This despite sending a screen cap. They do not attempt to explain why Brazil needs special treatment from all other localizations or why this isn't indicated in App Store Connect. I assume they are saying that despite the images already being there, I need to copy them to the Brazil localization anyway for some unknown reason. This article indicates Brazil is a new addition to ASA for this year. This makes me suspect it may have a glitch. I intended to only advertise in a few markets to start. Which didn't include Brazil initially. But ASA Basic isn't spending at all. On second attempt, it did net five downloads the first day and then hasn't had once since. This made me suspect one glitch may be causing another. Or maybe it is unrelated and advertising costs are just insane. Still, I think it's a possible glitch worth investigating.
1
0
586
Nov ’24
AppIntent Title Localization
Does anyone know how to localize the title of the shortcut? I tried to create a localizable file and then do a french translation. However, when I reference it as my shortcut title and change my simulator's language to the translated language (in this case french) it still displays the title in the english translation. for example: my Localizable.strings file says in english: "shortcutTitle" = "Hello!"; in french: "shortcutTitle" = "Bonjour!"; and then my AppIntent says: static var title: LocalizedStringResource{return LocalizedStringResource("shortcutTitle")}
1
0
920
Jul ’24
Disable automatic InfoPlist.xcstrings generation
Hi all, I am trying to localise the purpose strings in my Info.plist file, for that I am using the InfoPlist.xcstrings file. In my app I have multiple targets, each with a different display name, the problem that I am facing is that when the InfoPlist.xcstrings file is automatically updated in each build the CFBundleDisplayName is always added to the file which forces me to have just one name for every target. So, I would like to know how others approach this problem and how can I resolve my situation. The ideal solution was that there was a way for me to disable this automatic generation (or at least trigger it by hand) once I have added all the purpose strings that I want to localise in multiple languages. If not, having one InfoPlist.xcstrings per target will also so it, although it will be a little harder to maintain. AFAIK, there's no documentation on the InfoPlist.xcstrings generation, so any help will be very much appreciated. Thank you all in advance
2
0
1.5k
Jul ’24
xcodebuild -exportLocalizations does not respect build scheme or configuration
Description of Problem We are exporting strings for localization using the command line tool xcodebuild -exportLocalizations. However, Xcode does not respect the scheme or configuration that we specify. It always builds the Debug configuration. This results in extraneous or incorrect strings being exported, e.g. strings from SwiftUI previews. Note: Exporting strings from within the Xcode IDE respects the selected scheme and configuration. However, exporting from the command line does not. Our real app’s Xcode project cannot export strings from within the Xcode IDE at all, as Xcode always attempts to build our iOS project using the macOS SDK, which obviously fails. So we must use the command line export. Also, a command line export is required for CI/CD pipelines. Sample Code ContentView.swift import SwiftUI struct ContentView: View { var body: some View { VStack { Text("Always") #if DEBUG Text("Debug-Explicit") Text("Debug-Implicit") #else Text("Release-Explicit") Text("Release-Implicit") #endif } .padding() } } // MARK: - Previews #if DEBUG struct ContentView_Previews: PreviewProvider { static var previews: some View { VStack { Text("Preview only string") ContentView() } } } #endif Localizable.strings /* Appears in all builds */ "Always" = "Appears in all builds"; /* Appears in debug builds only */ "Debug-Explicit" = "Appears in strings file but only used in Debug builds"; /* Appears in release builds only */ "Release-Explicit" = "Appears in strings file but only used in Release builds"; Steps to Reproduce Clone this project into a directory on your Mac, but do not open it in Xcode. git clone https://dev.azure.com/slardieri/ReproRepos/_git/ExportRepro Open a Terminal window and cd into that directory. Run the following command to export strings for localization: xcodebuild -exportLocalizations -sdk "iphoneos" -exportLanguage "en" -localizationPath "./ExportRepro Localizations" -project "./ExportRepro.xcodeproj" -scheme "ExportRepro Release" -configuration "Release" Open the generated en.xliff file and observe which strings were exported. open "./ExportRepro Localizations/en.xcloc/Localized Contents/en.xliff" Expected Behavior Based on the Release configuration specified in the command, you should see both the Release-Explicit and Release-Implicit strings, but not the Debug-Implicit or Preview only string. Actual Behavior What you actually get are the Debug-Explicit, Debug-Implicit, and Preview only strings, but not Release-Implicit.
3
1
730
Jul ’24
QLPreviewController's PencilKit sub component doesn't get mirrored on RTL Languages in iOS18b3
QLPreviewController's PencilKit doesn't get mirrored when used with a RTL language in iOS18b3. Moreover, the sub-menu of the actions is not translated and is shown in English. Steps to reproduce: Set an app with QLPreviewController and set its app language to Hebrew (or any other RTL language) Run the app Tap the Markup button on bottom-left side. Look on the PencilKit element. Tap the + button to show the annotation actions. Look on the annotation actions menu. Current: The Pencil Kit element is not mirrored when app language is RTL Language and the sub-menu actions are shown in English. Expected: The Pencil Kit element is mirrored when app language is RTL Language and the sub-menu actions are shown in the RTL Language. Submitted Feedback: FB14452847 Notes: This wasn't reproducible in iOS 17.5.1 The top bar buttons are mirrored as expected with a RTL language.
5
0
1.2k
Aug ’24
XCode 16 beta2 (beta1 also) hangs when trying to open complex Localizable.xcstrings
XCode 16 beta1 and beta2 hangs whenever I try to open Localizable.xcstrings. The localization screen appears but afterwards XCode becomes unresponsive until I kill it. To make matters worse, upon restart the last window, Localizaton is reloaded, instantly causing a hang again (I need to be super quick as I have about half a second to try to click elsewhere like crazy). The same localization strings file works fine on XCode 15.4. I tried to export all localizations in 15.4, empty the file, re-generate localization strings, re-import languages one by one in 16, starting with different languages (thinking maybe a weird exotic character causes the issue with one of the languages, this happened previously crashing XCode 15 until I found the offending character and replaced it with something else). But generally even after just adding a single language there is a serious slowdown - after adding the second one, XCode hangs again. Note: the app in question has a lot of localizable strings - I had no issue creating a simple project with only a few strings. Just hoping a fix - I really wished the issue was fixed in beta2 but now I am a bit concerned that maybe it's a rare problem and might not get fixed as I saw no similar reports so far.
15
1
2.4k
Oct ’24