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")
}
}
Localization
RSS for tagLocalization is the process of adapting and translating your app to multiple languages.
Posts under Localization tag
101 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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?
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
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.
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
只能在string catalog里面添加语言,不能删除语言??这是什么设计?
在Project里面删除语言,并不能删除Localizable中的语言。但是如果这个语言没有任何国际化,是可以的。
也就是说,删不了曾经做过国际化的语言。
我应用还没发布,还在开发呢,为什么不让我删除语言??????????????????????????、
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.
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.
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.
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)
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...
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.
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.
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?
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.
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.
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.
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?
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
**My app contains 2 languages and it works fine when I use it, so it's not an app issue.
**
But on appstoreconnect it only shows me one language, why doesn't the second one appear?
appstoreconnect -> myapp -> distributions
This is what I would like to see