Localization

RSS for tag

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

Posts under Localization tag

82 Posts

Post

Replies

Boosts

Views

Activity

Localization not working for App Intents defined inside Swift Package and used in Widget Extension
Hi there, I’m having trouble with localization for App Intents used in a configurable widget when the intents are defined inside a Swift Package. The intents appear correctly in the widget configuration UI and function as expected, but the localized strings are not displayed. Instead, the widget shows the localization keys themselves. Setup Xcode: 26.1 iOS: 26 The App Intents are used for a configurable widget Intent is located in a Swift Package The Widget Extension depends on the package AppIntentsPackage setup: // In the package public struct MySharedIntentsPackage: AppIntentsPackage {} // In the widget extension import AppIntents import SharedAppIntents struct WidgetIntentsPackage: AppIntentsPackage { static var includedPackages: [any AppIntentsPackage.Type] { [MySharedIntentsPackage.self] } } What I’ve tried I tested several configurations separately to see which setup allows localization to work: Localizing inside the Swift Package Placed a Localizable.xcstrings file inside the Swift Package. Specified .module for the bundle parameter in LocalizedStringResource initializers. → The widget still displayed the localization keys. Localizing inside the Widget Extension Placed a Localizable.xcstrings file inside the Widget Extension target instead of the package. → The widget continued to show the localization keys. Allowing mixed localizations Added CFBundleAllowMixedLocalizations = YES to the Widget Extension’s Info.plist. → No change; the widget still showed the keys. Problem In the WWDC 2025 session “Get to Know App Intents”, it was announced that App Intents would officially support Swift Packages. However, despite following that guidance, here we have a situation where the localizations do not work and only the keys appear in a configurable widget’s configuration UI. When I move the same App Intent code directly into the Widget Extension target, localization works as expected, but not when the intent remains inside the Swift Package. Question Is localization for App Intents defined in Swift Packages officially supported for configurable widgets? If yes: Which bundle does App Intents use to resolve localized strings? Should the .xcstrings file be placed in the package or in the host extension’s bundle? Or is this a current limitation or known issue? Any clarification or workaround would be greatly appreciated. Thank you.
1
0
53
10h
How can I remove a localization from a String Catalog in a Swift Package?
Hello, I'm trying to remove a localization from a String Catalog in a Swift Package. How can I do that? I tried to remove the file and create a new one, but all the languages are back. The only place where I've found a reference to the languages is in Package/.swiftpm/xcode/package.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate But I don't know how to edit this file to remove a language. Thank you, Axel
2
0
99
2w
How can I optimize multilingual string translations in SwiftUI for App Store apps using Localization APIs?
Hi team, I’m developing an iOS app that helps manage and translate multilingual content . The app uses SwiftUI with Localizable.strings and Bundle.localizedString(forKey:). I’m trying to optimize for dynamic language switching inside the app without restarting. I’ve tested various methods like: Text(NSLocalizedString("welcome_text", comment: "")) and some approaches using @Environment(.locale), but the system doesn’t always update views instantly when language changes. Question: What’s the recommended approach (or WWDC reference) for real-time language change handling in SwiftUI apps targeting iOS 18+?
1
0
112
Oct ’25
How to properly localise AppShortcutPhrase?
Hi, I have AppShortcutsProvider in my app target(not as a separate extension) to support Siri command. It is working perfectly in English, but I would also like to add a localisation on it as my app supports multiple languages. struct MyShortcuts: AppShortcutsProvider { static let shortcutTileColor: ShortcutTileColor = .grape static var appShortcuts: [AppShortcut] { AppShortcut( intent: NextClassAppIntents(), phrases: [ "What is my next class in \(.applicationName)?", "What's the next class in \(.applicationName)?", "Next class in \(.applicationName)." ], shortTitle: "Next Class", systemImageName: "calendar.badge.clock" ) } } Xcode String Catalog was doing great jobs, It also detected shortTitle automatically and added that to the Catalog. However, I don't see localisation for those phrases anywhere in the String Catalog and when I try to use String(localized: ), compiler gives me an error. How can I properly localise AppShortcutPhrase?
1
0
79
Oct ’25
How to record voice, auto-transcribe, translate (auto-detect input language), and play back translated audio on same device in iOS Swift?
Hi everyone 👋 I’m building an iOS app in Swift where I want to do the following: Record the user’s voice Transcribe the spoken sentence (speech-to-text) Auto-detect the spoken language Translate it to another language selected by the user (e.g., English → Spanish or Hindi → English) Speak back (text-to-speech) the translated text on the same device Is this possible to record via phone mic and play the transcribe voice into headphone's audio?
0
0
158
Oct ’25
iOS 26 - Widget not updated with respect to main app's system preferred language
Hi, My iOS app's home screen widget content was implemented to base on the preferred language of my main app (e.g. my app has the following preferred language options with this order English, Japanese, Traditional Chinese, Korean, Simplify Chinese). Say the main app is currently using English as their preferred language, I can change the preferred language in the iOS Settings -> Apps -> My App -> Preferred Language. My widget's content will respect to the preferred language option that I selected with only exception if I switch back to English language and my Widget's content won't get updated. The Main app content is always update with respect to the selected preferred language. My app and widget is working without any issue in iOS 18. Other things that I had discovered during my testing under iOS 26, the "first" language appeared in my preferred language always being the issue (e.g. if the first language is Japanese , once I change to other languages and than switch back to Japanese, my widget content won't respect to this but the main app content are ok). Any one has a similar issues regarding the preferred language?
2
1
167
Oct ’25
xcodebuild -exportLocalizations Fails Due to Cross-Platform Dependencies
I'm working on a large multi-platform iOS project (iOS, iPadOS, watchOS, tvOS, visionOS) and have successfully migrated from legacy .strings files to modern String Catalogs (.xcstrings). However, I'm unable to export localizations using xcodebuild -exportLocalizations due to cross-platform framework dependency issues. (Note: I did have AI help me write this question, so apologies in advance for any errors) Project Structure Main iOS/iPad app with multiple extensions watchOS companion app tvOS app visionOS app 49 .xcstrings files successfully migrated across all targets Uses Swift Package Manager for modularization The Problem When attempting to export localizations using xcodebuild -exportLocalizations, the build fails because it tries to build all targets across all platforms, including watchOS targets that depend on third-party xcframeworks that don't include watchOS slices: xcodebuild -exportLocalizations \ -project MyProject.xcodeproj \ -scheme MyApp \ -localizationPath ./export \ -configuration Debug Error: error: While building for watchOS, no library for this platform was found in 'Frameworks/<incompatible>.xcframework'. (in target 'Target') These frameworks cannot be modified to add watchOS support (third-party/legacy dependencies). What Works vs. What Doesn't Works: Building the iOS app through Xcode GUI Fails: Exporting localizations through Xcode GUI (Product → Export Localizations...) Fails: xcodebuild -exportLocalizations with any combination of flags Attempted Solutions (All Failed) Platform-specific destination: xcodebuild -exportLocalizations -destination "generic/platform=iOS" ... SDK constraint: xcodebuild -exportLocalizations -sdk iphoneos ... Excluding architectures: xcodebuild -exportLocalizations EXCLUDED_ARCHS="armv7k arm64_32" ... Build first, then export: xcodebuild build -scheme MyApp -sdk iphoneos && \ xcodebuild -exportLocalizations ... All approaches still attempt to build watchOS targets despite platform constraints. Observations The -exportLocalizations flag appears to ignore -destination and -sdk flags It seems to scan and build ALL schemes/targets in the project regardless of constraints Regular builds (xcodebuild build) work fine with platform constraints Current Workaround I created a Python script that parses .xcstrings JSON files directly and generates XLIFF output, which works but feels like it's bypassing Apple's intended workflow. Questions for Apple Is there a way to limit xcodebuild -exportLocalizations to specific platforms? The documentation doesn't mention any flags for this, and -destination/-sdk appear to be ignored. Why does -exportLocalizations require building ALL targets across ALL platforms? Both the Xcode GUI (Product → Export Localizations) and xcodebuild -exportLocalizations fail with identical build errors, suggesting this is by design. Is there a reason localization export can't be limited to buildable targets? Is the intended workflow to have ALL targets buildable across ALL platforms before exporting localizations? This seems impractical for multi-platform projects with platform-specific dependencies. Are there any build settings or configuration options that can exclude specific targets/platforms from the localization export scan? Is directly parsing .xcstrings files and generating XLIFF an acceptable alternative, or does this miss important metadata that -exportLocalizations would include? Environment Xcode 16.x / 26.x (reproduces on both) macOS Tahoe Project uses String Catalogs (.xcstrings) format Mixed SPM packages and traditional target structure Any guidance on the correct approach for multi-platform localization export would be greatly appreciated. Is this a known limitation, or is there a recommended pattern I'm missing?
5
0
199
Oct ’25
Can’t change Primary Language — blocked by “for each version” even after deleting all CPPs (8 weeks, 10+ replies)
For ~8 weeks (10+ support replies) I’ve been unable to switch my app’s Primary Language from en-CA to en-US. App Store Connect shows: “Primary Locale couldn’t be saved because you must first provide all the required screenshots for each version in this language.” State: Default product page has complete iPhone + iPad screenshots for en-US and en-CA (live/approved). Issue began before any CPP existed; I have since removed all CPPs. Error persists, which suggests a stale/ghost CPP localization still being validated, or other issues. Questions: What does “for each version” precisely validate (live / in-prep / historical; default vs CPP)? Can deleted/never-approved CPPs still be validated, and how can they be purged? Anyone seen this after CPP removal—what fixed it? Happy to DM an Apple Staffer the case ID, a HAR of the failed save, and a short screen recording. Thanks! P.S. This has been open for ~8 weeks; I’m seeking an engineering-owned view to identify the specific unmet validator requirement or confirm a product issue. P.S.S. the App Catalog Report for my account is currently returning an empty file (Email) (requested via Apps → … → Reports). If others have seen this recently, is there a workaround - or should I file Feedback?
1
0
128
Sep ’25
Apple Intelligence language
I found what might be a bug with enabling Apple Intelligence when switching languages. When my iPhone's language is set to Catalan, the Apple Intelligence is disabled because it is not available for that language. Switching to Spanish doesn't activate it, and it still shows the same message of being unavailable, this time saying not available in Spanish (which is not true). However, it is enabled when the phone is rebooted. Once at this point, the bug becomes even weirder. Having the iPhone language set to Spanish and with Apple Intelligence on, I switch the language to Catalan, and the feature remains enabled. After I ask a query in Catalan, it surprisingly understands it and works, but then it gets disabled. Apart from that, as user feedback, I would love to activate Apple Intelligence in an available language other than my device's language. That's how I always used Siri (iPhone in Catalan, Siri in Spanish). Thanks!
2
1
969
Sep ’25
Failed to change the TTS language to CN or TW
I have some question about the TTS My device default language is zh-HK. (cantonese) my device is iPhone 16 Pro, IOS 18.6 I create a function speakMandarin I want the device to speak the zh-CN (putonghua) however the device only can speak zh-HK (cantonese). I already set the AVSpeechSynthesisVoice language as zh-CN func speakMandarin(text: String) { print("speakMandarin, \(text)") lastError = nil // Reset error // Stop any ongoing speech before starting new if synthesizer.isSpeaking { synthesizer.stopSpeaking(at: .immediate) } // Configure speech utterance let utterance = AVSpeechUtterance(ssmlRepresentation: text)! utterance.rate = 0.5 // Natural speaking speed utterance.pitchMultiplier = 1.0 utterance.volume = 1.0 utterance.voice = AVSpeechSynthesisVoice(language: "zh-CN") let preferredLanguages = [ "zh-CN" , "zh-TW"] var selectedVoice: AVSpeechSynthesisVoice? for lang in preferredLanguages { if let voice = AVSpeechSynthesisVoice(language: lang) { print(lang) selectedVoice = voice utterance.voice = voice break } } // If no Mandarin voice found, use system default if selectedVoice == nil { selectedVoice = AVSpeechSynthesisVoice(language: nil) lastError = "未偵測到普通話語音包,將使用系統預設語音" print (lastError) } utterance.voice = selectedVoice print(utterance) synthesizer.speak(utterance) } here is my log speakMandarin, <speak>你好!我們來聊聊喜歡的動物吧。你喜歡什麼動物呢?</speak> zh-CN [AVSpeechUtterance 0x1194efb80] String: 你好!我們來聊聊喜歡的動物吧。你喜歡什麼動物呢? Voice: [AVSpeechSynthesisVoice 0x104ceff90] Language: zh-CN, Name: Tingting, Quality: Default [com.apple.voice.compact.zh-CN.Tingting] Rate: 0.50 Volume: 1.00 Pitch Multiplier: 1.00 Delays: Pre: 0.00(s) Post: 0.00(s)
0
0
219
Sep ’25
macOS Document-Based SwiftUI App: “Save” menu item not localized in French
Hi everyone, I’ve run into a strange localization issue with macOS document-based apps in SwiftUI/AppKit. I created a standard document-based macOS app in Xcode (SwiftUI template) and added a French localization to the project. All system-generated menu bar commands (File → New, Close, Print, etc.) are correctly translated into French… except for “Save”, which remains in English. To rule out problems in my own code, I created a fresh, unmodified document-based app project in Xcode, and immediately added French localization without touching any code. Same result: all commands are translated except “Save”. This suggests the issue isn’t specific to my app code, but either the project template, or possibly macOS itself. My environment • Xcode version: 16.4 • macOS version: 15.6.1 Sequoia] • Swift: Swift 6 Questions 1. Has anyone else seen this issue with the “Save” command not being localized? 2. Is this expected behavior (maybe “Save” is handled differently from other menu items)? 3. If it’s a bug in the template or OS, is there a known workaround? Thanks for any insights P.S. Please note that I'm a total beginner
4
0
112
Sep ’25
Network extension doesn't get the updated preferred language after changing phone language
We’ve noticed an issue where after running a network extension, if the phone’s language is changed the Locale.preferredLanguages array is not updated and still returns the old array. It only returns the updated array when the app is reinstalled or the phone is restarted. This is unlike the app itself where using the same Locale.preferredLanguages API immediately returns the updated array. We think this issue is also the cause of notifications that are sent by the network extension being in the previous language as long as the app isn’t reinstalled or the phone is restarted, despite our Localizable file having localised strings for the new language. Feedback ID: FB20086051 The feedback report includes a sample project with steps on how to reproduce the issue.
5
1
131
Sep ’25
Swift Package Manager – Support for Multiple Targets with Distinct Localization Files
I am an SDK provider working with Swift Package Manager (SPM) to deliver libraries for iOS developers. My SDK currently uses SPM targets to modularize functionality. However, SPM enforces strict resource bundling, which prevents me from efficiently offering multiple targets—each with a different set of localization files—in a single package. Current Limitation: When multiple SPM targets share the same source and resource directory but require distinct sets of .lproj localization folders (for app size or client requirements), SPM raises “overlapping sources” errors. The only workaround is to manually split resource directories or have clients prune localizations post-build, which is inefficient and error-prone. Feature Request: Please consider adding native support in Swift Package Manager for: Defining multiple targets within a single package that can process overlapping source/resource directories, Each target specifying a distinct subset of localization resource files via the exclude or a new designated parameter, Enabling efficient modular delivery of SDKs to clients needing different localization payloads, without redundant resource duplication or error-prone manual pruning. Support for this feature would greatly ease SDK distribution, lower app sizes, and improve package maintainability for iOS and all Swift platforms.
0
0
894
Sep ’25
Force a locale from string catalog
I'm writing an iOS app that shares content with buddies. So my app will run in one language but the shared content will use the locale configured for the buddy. I found this Apple documentation which suggests that locale: (Locale(identifier: is the solution. Apple Documentation But I can't get it to work. Here's sample code. struct LocalizationDemoView: View { @State var isEnglish = true var body: some View { var myLocale: String { isEnglish ? "en": "de" } VStack { Toggle("Switch language", isOn: $isEnglish).frame(maxWidth: 200) HStack { Text("\(myLocale): ") Text(String(localized: "Hello world!", locale: (Locale(identifier: myLocale)), comment: "To share")) } } } } And here's the excerpt from the string catalog: { "sourceLanguage" : "en", "strings" : { "Hello world!" : { "comment" : "To share", "localizations" : { "de" : { "stringUnit" : { "state" : "translated", "value" : "🇩🇪 Moin Welt!" } }, "en" : { "stringUnit" : { "state" : "translated", "value" : "🇬🇧 Hello world!" } } } } } } Has Apple reduced support for string catalogs or is my code wrong? Xcode 16.4 compiled on MacOS 15.6.1, device iOS 18.6.2
4
0
249
Aug ’25
How to use String Catalogs for intents definition file / custom intents?
Hi, I'm migrating my project from the old .strings files to String Catalogs (.xcstrings files). Everything is migrating over fine except for my custom intents. Right now the localization files for my custom intents all live "under" the definition file like so: But there is no option to migrate to a string catalog. I even tried removing the localization files, and re-adding them using the "Localize..." button, but that just creates the old .strings files, not the new string catalog. Is this not supported yet for intents definitions? I can't find any documentation about this. It would be a real shame to have part of my app on string catalogs and this one piece on the old Localizable.strings format.
1
0
304
Aug ’25
Unable to localize driver name or description
I am trying to localize the CFBundleDisplayName and OSBundleUsageDescription of a driver that is part of an app. I am able to use InfoPlist.strings files to localize the Bundle display name for the app, but when I try to use the same file as part of the driver, the name displayed in settings for the app does not change correctly. In fact, it seems to follow the default language set in the xcode project. If the default language is not included in the suite of InfoPlist.strings files, it seems to take the string from the info.plist file. sometimes it just seems to take the English version regardless of the default language or tablet language. Has anyone had success with this?
4
7
157
Aug ’25
AVSpeechSynthesizer read Mandarin as Cantonese(iOS 26 beta 3))
In iOS 26, AVSpeechSynthesizer read Mandarin into Cantonese pronunciation. No matter how you set the language, and change the settings of my phone system, it doesn't work. let utterance = AVSpeechUtterance(string: "你好啊") //let voice = AVSpeechSynthesisVoice(language: "zh-CN") // not work let voice = AVSpeechSynthesisVoice(language: "zh-Hans") // not work too utterance.voice = voice et synth = AVSpeechSynthesizer() synth.speak(utterance)
1
0
229
Aug ’25
Change iOS Keyboard Language without adding to Settings > Keyboards
The first-party Apple Translate app will switch the on-screen keyboard to the selected language, even when the keyboard for that language is NOT added in Settings > General > Keyboards. We'd like to mirror this behavior and switch the keyboard for input based on a user-selected language from a drop-down without the user needing to add that language to Keyboards I'm struggling to find if this behavior is achieved via a public API. Any insights here?
1
0
63
Aug ’25