Localization

RSS for tag

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

Posts under Localization tag

97 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Bundle.main.preferredLocalizations vs. Locale.preferredLanguages vs. "AppleLanguages"
On iOS Bundle.main.preferredLocalizations returns the list of languages the application bundle supports in user-preferred order with the first element being the language the application is running in. Additionally Locale.preferredLanguages returns the list of languages in the order they are presented in Preferences.app > General > Language & Region > Preferred Languages with the first element being the user's "primary language" (i.e. the language the system is running in). However this only seems to be true unless the user has chosen a per-app language which is different from the primary language in which case Locale.preferredLanguages.first is equal to Bundle.main.preferredLocalizations.first - regardless of the latter's position in the Preferred Languages list. Furthermore this seems to change depending on the value of the "AppleLanguages" key in the User Defaults' global domain (see c.f. https://stackoverflow.com/a/42648166). Is this behaviour documented anywhere? Addendum: I know that according to https://forums.developer.apple.com/forums/thread/718512?answerId=733680022#733680022 AppleLanguages is an implementation detail, not something that’s considered API. Locale.preferredLanguages is API, though.
0
0
400
Dec ’24
How to Set Azerbaijani as Default Language for My App?
Hi everyone, I’m facing an issue with setting Azerbaijani as the default language for my app. The app is designed specifically for the Azerbaijani market, where the primary language is Azerbaijani, although Russian is also widely spoken. During the submission process, I couldn’t find an option to set Azerbaijani as the default language. To move forward, I selected Russian, assuming I could change it later. However, I’ve hit a roadblock—I can’t figure out how to make Azerbaijani the default language now. Has anyone else encountered this problem? Is there a workaround or solution to enable Azerbaijani as the default language? I’d greatly appreciate any advice or guidance from the community. Thanks in advance!
1
0
416
Dec ’24
Parametrized Shortcuts do not show up in Shortcuts app and search with localisation.
Hi! When my device is set to English, both search and the Shortcuts up automatically show multiple shortcuts parametrised for each value of the AppEnum - which is what I expected. When my device is set to German, I get only the basic AppShortcut without the (optional) parameter. I am using an AppEnum (see below) for the parametrised phrases and localise the phrases into German with an AppShortcuts String Catalog added to my project. Everything else seems to work, I can use my AppShortcut in the Shortcuts app and invoke it via Siri in both English and German. The Shortcuts app displays the values correctly using the localized strings. Any ideas? import AppIntents class ApolloShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: GetIntent(), phrases: [ "Get data from \(.applicationName)", "Get data from \(.applicationName) for \(\.$day)", "Get data from \(.applicationName) for the \(\.$day)" ], shortTitle: "Get Data", systemImageName: "wand.and.sparkles") } } enum ForecastDays: String, AppEnum { static var typeDisplayRepresentation: TypeDisplayRepresentation = "Day" static var caseDisplayRepresentations: [Self : DisplayRepresentation] = [ .today: DisplayRepresentation(title: LocalizedStringResource("today", table: "Days")), .tomorrow: DisplayRepresentation(title: LocalizedStringResource("tomorrow", table: "Days")), .dayAfterTomorrow: DisplayRepresentation(title: LocalizedStringResource("dayAfterTomorrow", table: "Days")) ] case today case tomorrow case dayAfterTomorrow var displayName: String { String(localized: .init(rawValue), table: "Days") } }
1
0
406
Nov ’24
Testing Right-to-Left localization in a macOS app
I’m currently trying to localize one of my Mac apps for Right-to-Left languages. In Xcode, to test this, I set the language to ‘Arabic’ in the scheme, which then displays the language and mirrors the layout accordingly. I have two questions about this: macOS titlebar buttons: In the title bar at the top, shouldn’t the Close and Minimize buttons also be on the right side (mirrored)? How can I test this? Numerals: My UI still displays Latin numerals (123). I know this is correct in some Arabic-speaking regions, but I’d also like to test cases where Arabic-Indic numerals (١٢٣) are used. Is there a way to configure the scheme to test this?
2
0
486
Nov ’24
How to localize permission description string?
What's the problem? My app requests location access and for that I need to provide a description for the user to read so that it is clear why we need this permission. I'm using the latest solution suggested by XCode for my app localization which is using Localizable.xcstrings file. But for the permission description, I'm adding the text to Targets -> Info -> Custom iOS Target Properties -> "Privacy - Location Always and When In Use Usage Description". I understand that the default language is English in this list so I provided it, but now I want this description to be translated to other languages so that my users can read it in their preferred language. What I have tried so far? I tried adding translation to the keys "INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription" and "NSLocationAlwaysAndWhenInUseUsageDescription" in my "Localizable.xcstrings" but it is always showing the description in English
2
0
566
Nov ’24
Label cannot export localized string key
Hello all. This is my code snippet. RecordListView() .tabItem { Label("Record List", systemImage: "list.clipboard") } .tag(Tab.RecordList) When I export localizations, there is no Record List in the .xcloc file. Then I use LocalizedStringKey for Label and export localizations file, the code is as follows: let RecordsString:LocalizedStringKey = "Tab.Records" RecordListView() .tabItem { Label(RecordsString, systemImage: "list.clipboard") } .tag(Tab.RecordList) There is still no Tab.Records.
2
0
538
Nov ’24
VoiceOver: Detect Languages
My app does not automatically switch languages (voices) in VoiceOver when I have VoiceOver on and the screen includes both English and Spanish content. Instead of switching between the correctly accented voice, whatever my manual Voices rotor setting is, that's what the content is announced as. I can manually switch the Voice in the rotor to make words sound inteligible but my main concern is that language changes are not auto-detected even though that feature in my Settings is on. VO does detect language changes in other apps, so I think there must be either misplaced or missing accessibiiltyLanguage strings somewhere in my app. Or is it more than that for localization considerations? I reached out to the Apple Accessibilty team and was directed to open a ticket here, as my question is about the underlying code. I am a novice developer and primarily accessibility SME; i expect that wnen "detect languages" is on in the user settings for VoiceOver, that the voice for the screen reader speech output will automatically switch to the correct language / accent. I recognize there is a problem but am not sure where the breakdown is. I would like guidance how to fix it to relay to my teams. https://developer.apple.com/documentation/objectivec/nsobject/1615192-accessibilitylanguage
1
0
625
Nov ’24
没法删除语言
只能在string catalog里面添加语言,不能删除语言??这是什么设计? 在Project里面删除语言,并不能删除Localizable中的语言。但是如果这个语言没有任何国际化,是可以的。 也就是说,删不了曾经做过国际化的语言。 我应用还没发布,还在开发呢,为什么不让我删除语言??????????????????????????、
1
0
247
Nov ’24
How to remove language in string catalog?
I have a Localizable file under Assets. I can add a language by click the + button. But I can't remove it then??!! Remove a localization in project -> info does not work. If the localization contains some translation, it still remains in the catalog (works if not translated at all). As a result, your app will not show the default localization at all.
0
0
263
Nov ’24
Calendar integers in english and alphabets in arabic
we are migrating our app to support Arabic language support but the requirement is we want the calendar/date object to display as missed. That is all the numbers in english digits and rest all the words like days, months should be in Arabic. I tried few options but at the end its resulting everything is in Arabic or in English but not the mixed as expected. Attaching the expected behavior.
2
0
427
Nov ’24
XCode 16 crash on commit - SourceEditorDataSource.contentRangeForLineRange(_:) + 244
Whenever there is any change in Localizable.xcstrings, XCode 16 simply crashes. This happens since early betas and continues even through the latest XCode 16.2 beta. The issue is probably due to some obscure character somewhere in the now monolithic Localization.xcstrings file which now contains all (sometimes rather exotic) localizations - thus making pinpointing the offending character basically impossible. The issue seems to happen when the Commit UI tries to produce the delta in the Localizable.xcstrings source code. The crash in question is this: Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 SourceEditor 0x132c33b04 SourceEditorDataSource.contentRangeForLineRange(_:) + 244 1 IDEDelta 0x362349768 specialized Collection.map<A, B>(_:) + 212 2 IDEDelta 0x362346198 SourceCodeGalleryExhibitEditor.delta_collapseToSuggestedLineRanges(for:) + 796 3 IDEDelta 0x362310e7c ComparisonContext.sessionDidScrapeDiffResults(_:) + 276 4 IDEDelta 0x3623111f8 @objc ComparisonContext.sessionDidScrapeDiffResults(_:) + 52 5 DeltaFoundation 0x1444bd4e8 -[DESession _notifySessionDidScrape] + 212 6 DeltaFoundation 0x1444bcf3c -[DESession _scrapeResults] + 400 I posted a FB about this way back then (FB14906558) and sent numerous reports but the issue is just not getting resolved.
1
0
600
Oct ’24
Cannot remove languages from Swift string catalog
I've got quite a problem as I've created a Localizible file with String catalog for my iOS app. For testing it out I've added lots of different languages and they all appeared in App settings. However, I need to remove most of them and they are still visible in the settings. What I tried so far: I have deleted EVERYTHING that had word localizable, localizations and etc. From Project Info also all the languages were removed and left only English and French. I also deleted my app, restarted the phone, downloaded the version without localizations from the app store and then install debug version (languages still appeared)
0
0
407
Oct ’24
Localizing CFBundleDisplayName based on specific region
Hi everybody, My team and I are currently working on an app that requires us to use localizations for the CFBundleDisplayName property in info.plist. However we are running into some issues ourselves, we need to localise the CFBundleDisplayName property for two specific countries: Netherlands Belgium We've tried to use the String catalog and we've added the corresponding languages/regions there: nl-BE (CFBundleDisplayName = x) nl-NL (CFBundleDisplayName = y) However the nl-BE localization does not seem to be used when changing the device language to Dutch (Belgium). It uses the nl-NL (y) value for the CFBundleDisplayName. Is it possible to use CFBundleDisplayName localizations for specific regions that use the same language? such as Belgium and the Netherlands. If not I fear that we need to build two apps...
1
0
743
Dec ’24
App Store localization fallbacks
How does the App Store handle localized content fallbacks in the store listing, in app products, and game center content? For example, if a user's language is set to Portuguese (Portugal) pt-PT, and I don't supply a translation for pt-PT but I do for pt-BR (Brazil), will it show the user the pt-BR translation or as a developer, do I need to provide both translations (i.e. all language variations/regions)? Another example, if I provide translations for en-US and en-GB and the user's language is Australian English (en-AU), will it show en-US or en-GB on the store or in Game Center? I would expect it to use en-GB.
1
0
899
Oct ’24
Translation API availability on visionOS
Hi, One of the great features introduced in WWDC24 is the Translation API. But unfortunately it's currently unavailable on visionOS. My question is, does Apple have any plan to support it on visionOS as well? If so, what's the ETA for this feature? I would really like to see it on visionOS, otherwise I'll have to pay Google to use their translation API.
1
0
542
Oct ’24
Fatal error calling TranslationSession.translate(String) in iOS 18
I'm trying to use the iOS 18 translation feature which works fine if I scroll slowly, but run into fatal errors when I scroll quickly. In my view, I have this state property: @State private var translationConfiguration: TranslationSession.Configuration? In the body, I attach a .translationTask closure to the top-level view: .translationTask(translationConfiguration) { translationSession in Task { @MainActor in ... let response = try await translationSession.translate(originalContent) // this line causes the fatal error. } } I also have an onAppear { } closure on the same top-level view, which sets translationConfiguration if it is nil, or calls translationConfiguration?.invalidate() if it's non-nil. When I scroll quickly, the view presumably appears and disappears quickly, but it seems that the translationTask closure still runs after the view disappears. I get this fatal error: Translation/TranslationError+TranslationOnly.swift:54: Fatal error: Attempted to use TranslationSession after the view it was attached to has disappeared, which is not supported. Instead of storing a TranslationSession instance outside of the .translationTask closure, trigger a .translationTask to run again on a visible view and use that TranslationSession instance. The recommendation from the error message seems incorrect, though. I am not using the TranslationSession instance outside of the translationTask closure. I'm using it only inside of it. I tried to keep an extra visible boolean property that gets set to true when the onAppear closure is called, and set to false when the onDisappear closure is called, and then I guard on that within the translationTask, but that doesn't fix the issue. What am I missing?
3
2
709
Nov ’24
English is missing from my languages on the App Store
I updated my app to support additional languages. However, when I checked the app in the App Store, the English language seems to have been removed. Here's the screenshot in my App Store Connect (Default English) App Store - Header (No English) App Store - Information - Languages (No English) Xcode - Project Info (Default English) Xcode - String Catalog (Default English) How can I get it back? Do I have to translate English to English in my String Catalog? or is this an error in the App Review side? I checked other apps supporting multiple languages and the still have English showing.
3
0
534
Oct ’24
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
906
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
304
Sep ’24