[tags:internationalization,localization]

97 results found

Post not yet marked as solved
0 Replies
155 Views
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.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.fromOpaque(idPtr).takeUnretainedValue() as? String print(String(describing: id)) This prints com.app
Posted
by
Post not yet marked as solved
3 Replies
Sorry for the late Reply (somehow I wasn't notified about your answers). @Claude31 I test on a real device. Thanks for the link. Unfortunately, the provided solution is nearly the same compared to what I have already tried with Locale.preferredLanguages above. @Frameworks Engineer To obtain the device language is a product management requirement to derive next steps in the app localization process.
Post not yet marked as solved
3 Replies
Hi, what’s your use case for fetching the device language instead of the preferred language?
Post not yet marked as solved
3 Replies
Do you test on device or on simulator ? I found that long thread that may provide some hint: https://developer.apple.com/forums/thread/9246
Post not yet marked as solved
3 Replies
372 Views
I have an localized iOS App from which I want to obtain the device language (not the app language). The following sample app is localized in English and German. The current app language is German. Here I want to obtain english, since that's the device language (see next screenshot). Device Language Settings: App Language Settings: (shouldn't be considered for obtaining device language) Is there any API I could use to retrieve the device language? To obtain the device language is a product management requirement to derive next steps in the app localization process. Code of sample App: struct ContentView: View { var body: some View { Form { Text(Hello, world) Text(Locale.preferredLanguages:n(Locale.preferredLanguages.joined(separator: , ))) Text(Locale.current:n(Locale.current.language.languageCode?.identifier ?? )) } } } Note: I have asked this question on Stack Overflow too (see here)
Posted
by
Post not yet marked as solved
0 Replies
433 Views
We want to implement Serbian (latin) language in our app. The idea is pretty simple: if user device's preferred language is Serbian (no matter, latin or cyrillic) – we use Serbian latin, which we have in our app. The problem is that it looks like this idea is unimplementable. If we use sr_Latn as code for Serbian latin in our Info.plist, and device's preferred language is just Serbian (which is Cyrillic in iOS) – the fallback in app will be English (default language), not Serbian latin. Reverse is the same: if we implement Serbian latin as sr (just Serbian), then user select Serbian latin (sr_Latn) as device's preferred language – then app language will be English, not Serbian. In the source code published on one of the forum's answer I see that it is expected fallback (unfortunately undocumented). This code is old one, but looks like behavior still persist. Is there any way to implement one Serbian for all cases?
Post not yet marked as solved
2 Replies
Thank you, great advice on Log Noise. Given the wording of the console message, it made it sound like I was doing something wrong, and yet the app behaved correctly. After looking over my code and implementation, everything seemed fine. At that point I went to check and compare sample code only to see the same message. With that said, I have filed Feedback #: FB13456050.
Post marked as solved
2 Replies
I think that’s a reasonable assumption. See On Log Noise for my criteria as to whether to worry about log entries like this. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Post marked as solved
2 Replies
616 Views
I am seeing the following log in the console in Xcode Version 15.0.1 (15A507): Cannot use inflection engine (Checking that the token is the correct type): I am able to reproduce the issue using Apple's own sample code, Building a Localized Food-Ordering App associated with WWDC21 Session 10109: What's New In Foundation, simply by building and running the sample code. That log message immediately appears a few times in the console when running that sample project. I'm assuming given it is happening in Apple's own sample project, that this is merely console noise and basically something out of my control.
Posted
by
Post not yet marked as solved
0 Replies
406 Views
I have the following requirement for my project: The app localization is currently based on static string JSON files. However, I would like to dynamically update strings upon an API call. Is it possible to update the resource files mentioned above after receiving a response from the API? If not, can I create a custom bundle to store new translations? Additionally, where should I create the custom bundle, specifying the path or location?
Posted
by
Post not yet marked as solved
2 Replies
We believe it should now be possible to submit your app with the locale folder sq-XK.lproj.
Post not yet marked as solved
0 Replies
445 Views
What's the right way to implement key equivalent matching that handles non-Roman/Latin layouts? E.g. pressing Cmd+Option+C in a Greek layout produces an NSEvent with chars=ç unmodchars=ψ, neither of which is going to match a key equivalent of Cmd+Option+C by simile comparison, yet performKeyEquivalent on a button with that exact key equivalent returns YES and activates the button. How would someone replicate that? [NSEvent charactersByApplyingModifiers:] also reports ç, and so does UCKeyTranslate. Yet the Keyboard Viewer shows a modifier layer with c, not the ç that the event reports:
Posted
by
Post not yet marked as solved
2 Replies
Try manually renaming your lproj folder from sq-XK.lproj to sq_XK.lproj. You should quit Xcode before doing this to ensure you don't have the project open in any capacity.
Post not yet marked as solved
2 Replies
852 Views
Our application should support locales for Albanian and Albanian(Kosovo). Xcode creates sq.lproj and sq-XK.lproj folders accordingly Everything works fine in xcode, but if we upload to appstore we always see this warning. I tried specifying other names for sq-XK to match https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html aln, sq-RS, sq-KV, sq-KS, sq-Latn-XQ. The varning was always present. Is there any way to get rid of it? WARNING ITMS-90176: Unrecognized Locale - The locale used in localization directories at (Payload/{AppName}.app/base.lproj) are invalid. iTunes supports BCP47 but not the UN M.49 specification. Refer to the Language and Locale Designations guide for more information on naming your language-specific directories.
Posted
by
Post marked as solved
3 Replies
usesBottomSafeArea is a new property introduced in iOS 17 to address this. Watch Keep up with the keyboard for more info. view.keyboardLayoutGuide.usesBottomSafeArea = false NSLayoutConstraint.activate([ collectionView.topAnchor.constraint(equalTo: view.topAnchor), collectionView.bottomAnchor.constraint(equalTo: view.keyboardLayoutGuide.topAnchor), collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor), collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor) ])