Localization

RSS for tag

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

Posts under Localization tag

133 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

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
0
0
22
2h
Wallet pass default localization rules
There must be some rules that determine which set of localized strings of an Apple Wallet pass (.pkpass) is used when the choice is not obvious. For instance, I made a pass with localization folders ko.lproj (Korean) pl.lproj (Polish) zh-Hans.lproj (Chinese). If any of these languages is in my iPhone's preferred languages (Settings... General... Language & Region), then it's easy: the first one on that list is used. But what if the list does not have any of them? When I try, it seems the Chinese localization is chosen by the Wallet app. Without the Chinese localization folder, it is Korean. If I also add ar.lproj (Arabic) then Arabic is chosen. I can't discern any system here. How does Wallet choose the default localization?
0
0
48
19h
Extensions and Widget localizations
Hi community: I'm experiencing an issue in iOS 17 where the Widgets and Extensions use the local device language instead of the app language (preferred languages displayed on the app settings). This issue was reproducible in iOS 16.1, but then was solved. Now it is back on iOS 17 and iOS 17.1 In terms of code, Locale.current in the app returns the language preference selection, even you can use bundle.main.preferredlanguages and get the first one (because there's a repetition from 2 to 3 times the same value) But in whatever extension, the app's preferred language cannot be got, it always returns the system's preferred language. @eskimo, Is it a known issue? Also, Xcode 15.3 shows 0 files localized when you use the strings catalog. I appreciate any help you can provide.
1
0
119
3d
Source string missing in exported localization files
Hi, we recently noticed an issue when exporting the localization files from one of our projects. So in the exported .xliff file, there is a string that has been varied into the plural forms of zero, one and other. We had translated them into Japanese. But in the .xliff file, the source element of this string in plural ONE is missing, while the target as well as the others plural strings are showing correct. We've also checked in Xcode (15.3), the content of whether the source or target are there for all the plural forms, as you can see below. The same issue (same string) also exists in Korean and Russian, but not in other languages we support (like German, French, Chinese), which is a bit weird to us. Does anyone have any idea why this is happening and how can we fix it?
1
0
167
May ’24
Exporting Localizations for Workspace fails with "ComputeTargetDependencyGraph failed with a nonzero exit code"
We have a workspace with three projects in it. Trying to export localizations for the workspace fails with the "ComputeTargetDependencyGraph failed with a nonzero exit code" error but with no additional information to track down the failure. Here are the exact steps I've tried: Click Menu Bar > Product > Export Localizations > Workspace (the first item in the menu) A few moments later, an error alert pops up that says "Unable to build project for localization string extraction" In the build log tab, it shows this: If I try running xcodebuild -exportLocalizations -localizationPath ~/ExportedWorkspaceLocalizations -workspace <workspaceLocation> -exportLanguage en, the same "ComputeTargetDependencyGraph failed with a nonzero exit code" error message appears. Exporting the three projects individually works great when I go to Menu Bar > Product > Export Localizations > Select one of the three projects instead of the workspace. Has anyone else run into this error? I haven't been able to find any additional build logs that would point to a more concrete error.
0
0
196
May ’24
String Catalog Package Override
I'm working on a large SDK of UI frameworks. We have hundreds of strings and an older implementation that resolves them by looking up the key in the main, then current (module) bundles. This allows clients to tailor strings and provide localisation for locales that we don't support. I want to move to String Catalogs and have a way of doing that with a similar solution using LocalizedStringResource. But this seems pointless as I would like to have client String Catalogs show all strings from dependencies (our UI frameworks). Stepping back a bit, the default API for LocalizedResources and Keys uses the main bundle and has bundle as a property but String Catalogs does not and cannot respect that (highlighted in this post). A possible Apple solution could be storing the module with the string in the String Catalog for that framework then the executable can correctly assess what strings it should include based on its dependencies String Catalogs. I am looking for a way around this? Or any suggestions? I believe it might be possible using a build tool plugin to generate the String Catalog for the clients from its dependency catalogs and this way I wouldn't need any trickery / can use the LocalizedResource API as is (main bundle).
0
0
247
Apr ’24
Request to Add Missing Characters for South Azerbaijani (azb) Language in Persian Keyboard
Dear Apple Developers, I am writing to kindly request the addition of a few missing characters to the Persian keyboard in order to better support the South Azerbaijani language (ISO 639-3 code: azb). South Azerbaijani is a Turkic language spoken by over 30 million people living primarily in northwestern Iran. The missing characters needed for proper South Azerbaijani language support are: ؽ (U+063D ARABIC LETTER GHAIN) وْ (U+0648 ARABIC LETTER WAW, U+0640 ARABIC TATWEEL) ۇ (U+06C7 ARABIC LETTER U WITH SMALL V) ۆ (U+06C6 ARABIC LETTER OW WITH SMALL V) Currently, ؤ (U+0624 ARABIC LETTER U WITH HAMZA ABOVE) is accessible by long-pressing the و key, which is great. However, the other characters are missing. My suggestions would be: Add ؽ to the long-press options for the ی key Add وْ, ۇ, and ۆ to the long-press options for the و key Introducing these few missing characters would greatly enhance the typing experience for South Azerbaijani users and allow for proper rendering of all letters in this language spoken by millions. Thank you for your consideration. I would be happy to provide any additional information needed. This small update would mean a lot to the South Azerbaijani community. Respectfully, Araz Gholami
2
1
307
Apr ’24
Cannot update Arabic via App Store Connect API
It looks like Arabic is not supported by BetaBuildLocalizationCreateRequest https://developer.apple.com/documentation/appstoreconnectapi/betabuildlocalizationcreaterequest/data/attributes Is there any way to update this localization programmatically? If not, any timeline when it will be available? The goal here is to add "What's New" notes automatically in CI
1
0
269
Apr ’24
Can't get Text Input Source region designator
I have a macOS application with a minimum version of macOS 12.0. I need to be able to get the current keyboard region designator. Example: The user selects a input source of English Canadian. What I want as a result of this fact is en-CA locale identifier. I get the current keyboard language with the following code func keyboardLanguage() -> String?{ let keyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue() let languagesPtr = TISGetInputSourceProperty(keyboard, kTISPropertyInputSourceLanguages)! let languages = Unmanaged<AnyObject>.fromOpaque(languagesPtr).takeUnretainedValue() as? [String] return languages?.first } This returns the language as en, but I don't see how I can get the region from Text Input Sources. I can get the input source id let keyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue() let idPtr = TISGetInputSourceProperty(keyboard, kTISPropertyInputSourceID)! let id = Unmanaged<AnyObject>.fromOpaque(idPtr).takeUnretainedValue() as? String print(String(describing: id)) This prints com.apple.keylayout.Canadian which points to the Canadian region but is not a region designator. I can possible parse this id and map it to a region designator but first I'm not sure if I will capture all of the regions and secondly what happens if the format of the id changes? If someone can point to the correct API to use it will be much appreciated.
0
1
318
Apr ’24
LocalizedStringRessource Initialisers Not Available For Most SwiftUI Views
I was wondering why the Text View in SwiftUI is (as far as I know) the only View that accepts a LocalizedStringRessource in its init. Are there better alternatives? I know there is LocalizedStringKey, which works great with SwiftUI Views but is limited if you want to access the localised string in non-UI code. This results in the inconvenient situation of writing code like this: struct LocalizedView: View { let localizedString = LocalizedStringResource("Localize Me!") var body: some View { Text(localizedString) // Does not work // Label(localizedString, systemImage: "questionmark") // Inconvenient Label(String(localized: localizedString), systemImage: "questionmark") } } Best, Chris
0
0
272
Mar ’24
String catalogs from a Swift package Not loaded
I have encountered an issue related to the usage of string catalogs in a Swift package. I created a repository for reproduction. https://github.com/atacan/DiscussionStringCatalogPackage The Readme.md file has all the details. Here is a short summary: The Package.swift file's target has resources: [.process("Resources")], and this Resources folder contains a string catalog. The catalog is correctly populated by the compiler, and German translations are added. Text view is using bundle: .module argument. However, when the scheme run options are changed to German, the UI still displays English text. Xcode throws a warning indicating that the German translation for the text is not found in the Localizable table of the bundle and it says (not loaded). Although the bundle contains translations in the Localizable.strings file. Screenshots of the issue are available in the original README file. I am looking for any insights or solutions to this problem.
3
0
435
Mar ’24
Exporting localization using xcodebuild with a project containing macros
I've a workspace with multiple packages, and due to the a bug in Xcode I cannot export the app localizations using the Xcode GUI tool, but I need to resort on using a command from terminal xcodebuild -exportLocalizations -localizationPath . -workspace &lt;path_workspace&gt; -sdk iphoneos -exportLanguage en One of my packages contains some macros, and I use them from my code without any problem, the code compile But when I try to export localizations using that command, the build fails due to "compiler plugin not loaded" So I cannot use Xcode normal exporting because Xcode bug, and cannot export by running a command due to the macro problem What should I do? It is very discouraging this situation, do you have any suggestion? I've found a similar problem
2
0
420
Mar ’24
Using String Catalog for Word Iteration/Partial Translation
I want to make use of String Catalog for some words that show the differences between countries like the USA and Canada. For example, I added both languages to my string catalog and I would like to have: Enter your Zip Code [English] Enter your Providence [English (Canada)] If I run the app without any change in the tables, I see all values shown correctly, but when I make this 1 word change in required field, all other strings start showing their keys instead of base values that are already in English language. What is the easiest way to achieve this using String Catalogs other than copy/pasting all the values from English table to English (Canada) table? I don't want to or need to translate all the strings in the catalog since they are literally the same, all I need is having iterations for some words.
0
1
292
Mar ’24
Composed string resources detected by Strings Catalog
I am using a string resource in the following way: let content = UNMutableNotificationContent() content.body = NSLocalizedString("notification_body_" + String(notificationBodyId), comment: "") And will have a number of strings defined in the strings catalog notification_body_1, notification_body_2 etc. This works fine, but the feature of strings catalogue that is automatically grepping source code for usage of strings is inserting an entry reality_check_notification_body_ that will obviously never be used & never be translated (thus showing my translated percentage at less than 100%). Xcode doesn't appear to provide a way for me to delete / ignore these automatically created string resources (delete button is disabled where available for manually created string resources). Is there some other way in code I should have referenced this resource, or some workaround to remove the string from strings catalog (no doubt if I manually remove from the backing file, it will simply be re-created). Thanks. Xcode 15.3
1
0
364
Mar ’24
xcode 15 LS instead of LF in the xcloc files
Hi, I'm parsing iOS localization files and during tests with xcode 15 i noticed new lines appear in the xcloc files with LS instead of the usual LF i was used to. Questions: is this the default behavior in xcode 15? Has this changed with this version? is this controllable by any settings? Disclaimer: not a iOS developer here, please pardon any confusions and have patience.
2
0
345
Mar ’24
SwiftUI #Preview generate localizable strings in the Xcode String Catalog
Since Xcode 15.1, when compiling SwiftUI previews (using #Preview macro), strings that are unique to #Preview declarations are getting extracted and processed to the application's localizable strings catalog. In Xcode 15.0.1, this still works as expected and only UI strings from non-preview UI declarations are extracted and processed. Afaik, there is no setting for this in Xcode 15.1 and up. Anyone knows any other solution to avoid our catalog gets muddled with preview strings? I've already been reporting this via the Feedback hub since 15.1, but have had 0 responses from Apple on this.
0
0
345
Mar ’24