Localization

RSS for tag

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

Posts under Localization tag

200 Posts

Post

Replies

Boosts

Views

Activity

Predicitive Text is presenting suggestions in incorrect language when 3rd party keyboard is installed
I'm the developer of a third-party keyboard app, Snippety - Snippets Manager, which is designed for using snippets rather than regular typing. One of my users has encountered a strange issue: after installing my keyboard (even when it is not actively in use), the predictive text bar starts showing suggestions in Polish. This happens despite the Polish language not being installed on the device. The issue resolves as soon as my keyboard is uninstalled from the system settings. Interestingly, my application (including the keyboard) does not support the Polish language, nor is Polish specified anywhere in the app. The app was developed and published from macOS in English. This seems to be an iOS bug. The only language-related configuration in my keyboard is the PrimaryLanguage key in the Info.plist file, which I set to "mul" because the keyboard is not intended for typing. I also tried setting it to "mis", but the issue persists. The video presenting this issue on an iPhone 15 simulator running iOS 17.5: https://www.dropbox.com/scl/fi/xjdyucxpmv1cv0mnmwzvd/prdictive-text-issue.mp4?rlkey=aphznpdti08pz8xl84ojbyxz3&dl=0 Info.plist for my keyboard: My project settings: Steps to reproduce: Configure iOS to use English language only, with English keyboard Enable predictive text feature in the system Install Snippety keyboard Use the regular keyboard & start typing "dzie" Actual result: Polish predictions appear even though the Polish language is not installed or declared by the keyboard. Expected result: The predictive text should present predictions based on system settings. What is even more weird, I discovered that when I add the keyboard in system settings, it automatically installs Polish language in the system settings. I even changed PrimaryLanguage to "de" (German) in Info.plist but it still installs Polish. See: https://www.dropbox.com/scl/fi/aiv5g4z331zwy827zj47v/incorrect-language-installed.mp4?rlkey=16v5gqmb6mj8yuyyd7jwmjnsw&dl=0 Any ideas what could be wrong? I also created a ticket: #FB13949087 I also found a similar issue from 2018 (O_O) reported here: https://stackoverflow.com/questions/53069262/ios-adds-new-preferred-language-when-installing-my-3rd-party-keyboard
3
1
1.1k
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?
3
0
1.5k
Aug ’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.3k
Aug ’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
537
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
1.1k
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
480
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.2k
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.3k
Aug ’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
999
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.7k
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
838
Jul ’24
LOCALIZED_STRING_MACRO_NAMES for Swift package targets?
I have a custom localisation function in my project that enforces the inclusion of the bundle parameter (specifically so that Swift packages are forced to include the Bundle.module value). While migrating to String Catalogs, I noticed that my custom localisation function wasn't being recognised by the automatic extraction that the Swift compiler is doing, but only in my Swift package targets. Is there a way to set something like LOCALIZED_STRING_MACRO_NAMES in Swift Packages?
1
0
905
Jul ’24
Localization for multiple targets
I have one project where I have XYZ scheme and target. I have Localizable.string under XYZ target for localization. I want to create a ABC target (duplicate of XYZ) and set custom language support for it. Let's say I have english, french and german for XYZ, I want hindi, japanese and chinese for ABC. I did the below steps I went to Manage scheme and duplicated the XYZ (duplicate scheme = ABC). I added new localization file only for ABC (LocalizationForABC.string) and made sure those reflect in File Inspector -> Target (only ABC selected) and also checked in Build Phases -> Copy Bundle Resources (LocalizationABC exists). When I run the ABC target under let's say french, it works fine but when I build the project ABC, and remove french from XYZ, ABC is broken and it only runs in english. Am I missing something here ?
3
0
1.1k
Jul ’24
Issue with localizable.strings file not found during archiving
I'm encountering the following error while attempting to archive my app: unable to read input file: fopen({~}/Library/Developer/Xcode/DerivedData/{project name}-gxaapsrbutxnmwderhyslgnfznrl/Build/Intermediates.noindex/ArchiveIntermediates/{project name}/IntermediateBuildFilesPath/{project name}.build/Release-iphoneos/{project name}.build.lproj/Localizable.strings, rb): No such file or directory (2) (in target '{project name}' from project '{project name}') I've anonymized {project name} and {~} in the path for privacy reasons. It seems like the error pertains to not finding the localizable.strings file. Prior to encountering this error, I made the following modifications: Originally, my project used the legacy localizable.strings for localization, but I recently switched to using a string catalog. I added 8 additional languages alongside the existing Base, English, and Korean. I'm writing into the new Localizable.xcstrings file using some python scripts. When I open it in Xcode after pasting, all rows appear correctly. This error occasionally occurred even when I 'run' the app, but clearing derived data and cleaning the build folder resolved it temporarily. However this error happens always when I try to 'archieve' this. Despite copying the project due to difficulty resolving the issue within the project itself, I'm still encountering the same problem. Below are the Build Setting and Build Phases configurations: Build Phases > Compile Sources and Link Binary with Libraries do not include localizable.strings. Build Settings > Localization is set to "Yes" for all. I've tried various methods found online without success, and similar cases are scarce. Please help me resolve this issue.
1
1
762
Jun ’24
Automatic Grammar Agreement with formatted number: use integer value to switch categories
Hello, I want to use Automatic Grammar Agreement to localise a string in my app, let say "three remaining activities". The string "three" is obtained by using a NumberFormatter with a numberStyle set to .spellOut (so I'm not using an Integer) var formatter: NumberFormatter = NumberFormatter() formatter.numberStyle = .spellOut let formattedCount: String = numberFormatter.string(from: count as NSNumber)! Text("key_with_string_\(formattedCount)") In my string catalog, I have translated the key key_with_string_%@ like this ^[%@ remaining activity](inflect: true), but it does not work. I've tried to add the integer value used by the number formatter in the key key_with_string_%@_%lld but it does not work. Should Automatic Grammar Agreement work normally just by using the formatted string provided by the NumberFormatter? If not, is there a way to specify to use a secondary variable (my count integer) to switch between different categories like one and other automatically? Thanks ! Axel
1
0
944
Jun ’24
Export localization not working when using packages due to unnecessary macOS compile
Hi This issue is present both in previous, current, and beta versions of Xcode When a project has localization in packages, Xcode FAILS to export localization The reason is that when trying to export in this configuration, the compiler will try to export using macOS sdk, but if the package support only iOS of course will not find symbols for frameworks and functions that are scoped only for iOS This behaviour is not changed when the platforms for the package includes ".macOS("99") has I've found as a suggestion online The only way to perform this operation is to run, from CLI the following command xcodebuild -exportLocalizations -localizationPath . -sdk iphoneos -project TranslateTest.xcodeproj -exportLanguage en The problem is that this command will not work when one of the packages contains a macro. The following error will return in CLI if the macro is used (if the package is only imported no error appears) error: external macro implementation type 'MyMacroMacros.StringifyMacro' could not be found for macro 'stringify' I've found online some suggestions from apple folks that says to replace -sdk iphoneos with -destination 'platform=iOS,name=Any iOS Device’ in case your project contains a macro, but this changes nothing in the final result, the export will fail I'm providing a zip for apple in the radar (cannot upload zip here) that contains 3 example project for the 3 cases: A project without any packages that can extract its strings with any mode A project with a package that can only extract its strings only by CLI A project with multiple packages, one of which has a macro, and it can never extract its string This problem affects any possibility to have a modularised application with localisations, macros, and packages. Feedback FB13902424
1
0
802
Jun ’24
iOS per app language settings shows more languages than selected in Xcode
Hi, My iOS app shows more language with region codes than what I've selected in Xcode: This is what I see in the language selection (simulator and device): How can I remove all the language with region codes? I want to remove: English (US) Suomi (Suomi) Deutsch (Deutschland) Kalaallisut (Kalaallit Nunaat) Norsk bokmål (Norge) Thank you!
Replies
1
Boosts
0
Views
617
Activity
Aug ’24
Predicitive Text is presenting suggestions in incorrect language when 3rd party keyboard is installed
I'm the developer of a third-party keyboard app, Snippety - Snippets Manager, which is designed for using snippets rather than regular typing. One of my users has encountered a strange issue: after installing my keyboard (even when it is not actively in use), the predictive text bar starts showing suggestions in Polish. This happens despite the Polish language not being installed on the device. The issue resolves as soon as my keyboard is uninstalled from the system settings. Interestingly, my application (including the keyboard) does not support the Polish language, nor is Polish specified anywhere in the app. The app was developed and published from macOS in English. This seems to be an iOS bug. The only language-related configuration in my keyboard is the PrimaryLanguage key in the Info.plist file, which I set to "mul" because the keyboard is not intended for typing. I also tried setting it to "mis", but the issue persists. The video presenting this issue on an iPhone 15 simulator running iOS 17.5: https://www.dropbox.com/scl/fi/xjdyucxpmv1cv0mnmwzvd/prdictive-text-issue.mp4?rlkey=aphznpdti08pz8xl84ojbyxz3&dl=0 Info.plist for my keyboard: My project settings: Steps to reproduce: Configure iOS to use English language only, with English keyboard Enable predictive text feature in the system Install Snippety keyboard Use the regular keyboard & start typing "dzie" Actual result: Polish predictions appear even though the Polish language is not installed or declared by the keyboard. Expected result: The predictive text should present predictions based on system settings. What is even more weird, I discovered that when I add the keyboard in system settings, it automatically installs Polish language in the system settings. I even changed PrimaryLanguage to "de" (German) in Info.plist but it still installs Polish. See: https://www.dropbox.com/scl/fi/aiv5g4z331zwy827zj47v/incorrect-language-installed.mp4?rlkey=16v5gqmb6mj8yuyyd7jwmjnsw&dl=0 Any ideas what could be wrong? I also created a ticket: #FB13949087 I also found a similar issue from 2018 (O_O) reported here: https://stackoverflow.com/questions/53069262/ios-adds-new-preferred-language-when-installing-my-3rd-party-keyboard
Replies
3
Boosts
1
Views
1.1k
Activity
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?
Replies
3
Boosts
0
Views
1.5k
Activity
Aug ’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.
Replies
5
Boosts
0
Views
1.3k
Activity
Aug ’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
Replies
1
Boosts
0
Views
537
Activity
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 "テスト".
Replies
1
Boosts
0
Views
1.1k
Activity
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?
Replies
0
Boosts
0
Views
480
Activity
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"; */
Replies
1
Boosts
1
Views
1.2k
Activity
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!
Replies
5
Boosts
0
Views
1.3k
Activity
Aug ’24
Improvements to the functionality of the Mail application
In my opinion, the mail app needs a built-in translator. Very often, letters arrive in different languages ​​and you have to take a screenshot and translate it in a third-party app.
Replies
0
Boosts
0
Views
522
Activity
Aug ’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")}
Replies
1
Boosts
0
Views
999
Activity
Jul ’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
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
Replies
2
Boosts
0
Views
1.7k
Activity
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.
Replies
3
Boosts
1
Views
838
Activity
Jul ’24
Apple Translate App URL Scheme
With the announcement of the new Apple Translate app and offline support, are there any URL schemes that we can use in our apps to send text to the Translate app and have it open and translate the sent text?
Replies
3
Boosts
0
Views
2.9k
Activity
Jul ’24
LOCALIZED_STRING_MACRO_NAMES for Swift package targets?
I have a custom localisation function in my project that enforces the inclusion of the bundle parameter (specifically so that Swift packages are forced to include the Bundle.module value). While migrating to String Catalogs, I noticed that my custom localisation function wasn't being recognised by the automatic extraction that the Swift compiler is doing, but only in my Swift package targets. Is there a way to set something like LOCALIZED_STRING_MACRO_NAMES in Swift Packages?
Replies
1
Boosts
0
Views
905
Activity
Jul ’24
Localization for multiple targets
I have one project where I have XYZ scheme and target. I have Localizable.string under XYZ target for localization. I want to create a ABC target (duplicate of XYZ) and set custom language support for it. Let's say I have english, french and german for XYZ, I want hindi, japanese and chinese for ABC. I did the below steps I went to Manage scheme and duplicated the XYZ (duplicate scheme = ABC). I added new localization file only for ABC (LocalizationForABC.string) and made sure those reflect in File Inspector -> Target (only ABC selected) and also checked in Build Phases -> Copy Bundle Resources (LocalizationABC exists). When I run the ABC target under let's say french, it works fine but when I build the project ABC, and remove french from XYZ, ABC is broken and it only runs in english. Am I missing something here ?
Replies
3
Boosts
0
Views
1.1k
Activity
Jul ’24
Issue with localizable.strings file not found during archiving
I'm encountering the following error while attempting to archive my app: unable to read input file: fopen({~}/Library/Developer/Xcode/DerivedData/{project name}-gxaapsrbutxnmwderhyslgnfznrl/Build/Intermediates.noindex/ArchiveIntermediates/{project name}/IntermediateBuildFilesPath/{project name}.build/Release-iphoneos/{project name}.build.lproj/Localizable.strings, rb): No such file or directory (2) (in target '{project name}' from project '{project name}') I've anonymized {project name} and {~} in the path for privacy reasons. It seems like the error pertains to not finding the localizable.strings file. Prior to encountering this error, I made the following modifications: Originally, my project used the legacy localizable.strings for localization, but I recently switched to using a string catalog. I added 8 additional languages alongside the existing Base, English, and Korean. I'm writing into the new Localizable.xcstrings file using some python scripts. When I open it in Xcode after pasting, all rows appear correctly. This error occasionally occurred even when I 'run' the app, but clearing derived data and cleaning the build folder resolved it temporarily. However this error happens always when I try to 'archieve' this. Despite copying the project due to difficulty resolving the issue within the project itself, I'm still encountering the same problem. Below are the Build Setting and Build Phases configurations: Build Phases > Compile Sources and Link Binary with Libraries do not include localizable.strings. Build Settings > Localization is set to "Yes" for all. I've tried various methods found online without success, and similar cases are scarce. Please help me resolve this issue.
Replies
1
Boosts
1
Views
762
Activity
Jun ’24
Automatic Grammar Agreement with formatted number: use integer value to switch categories
Hello, I want to use Automatic Grammar Agreement to localise a string in my app, let say "three remaining activities". The string "three" is obtained by using a NumberFormatter with a numberStyle set to .spellOut (so I'm not using an Integer) var formatter: NumberFormatter = NumberFormatter() formatter.numberStyle = .spellOut let formattedCount: String = numberFormatter.string(from: count as NSNumber)! Text("key_with_string_\(formattedCount)") In my string catalog, I have translated the key key_with_string_%@ like this ^[%@ remaining activity](inflect: true), but it does not work. I've tried to add the integer value used by the number formatter in the key key_with_string_%@_%lld but it does not work. Should Automatic Grammar Agreement work normally just by using the formatted string provided by the NumberFormatter? If not, is there a way to specify to use a secondary variable (my count integer) to switch between different categories like one and other automatically? Thanks ! Axel
Replies
1
Boosts
0
Views
944
Activity
Jun ’24
Export localization not working when using packages due to unnecessary macOS compile
Hi This issue is present both in previous, current, and beta versions of Xcode When a project has localization in packages, Xcode FAILS to export localization The reason is that when trying to export in this configuration, the compiler will try to export using macOS sdk, but if the package support only iOS of course will not find symbols for frameworks and functions that are scoped only for iOS This behaviour is not changed when the platforms for the package includes ".macOS("99") has I've found as a suggestion online The only way to perform this operation is to run, from CLI the following command xcodebuild -exportLocalizations -localizationPath . -sdk iphoneos -project TranslateTest.xcodeproj -exportLanguage en The problem is that this command will not work when one of the packages contains a macro. The following error will return in CLI if the macro is used (if the package is only imported no error appears) error: external macro implementation type 'MyMacroMacros.StringifyMacro' could not be found for macro 'stringify' I've found online some suggestions from apple folks that says to replace -sdk iphoneos with -destination 'platform=iOS,name=Any iOS Device’ in case your project contains a macro, but this changes nothing in the final result, the export will fail I'm providing a zip for apple in the radar (cannot upload zip here) that contains 3 example project for the 3 cases: A project without any packages that can extract its strings with any mode A project with a package that can only extract its strings only by CLI A project with multiple packages, one of which has a macro, and it can never extract its string This problem affects any possibility to have a modularised application with localisations, macros, and packages. Feedback FB13902424
Replies
1
Boosts
0
Views
802
Activity
Jun ’24