We have an iOS App that supports only English-language UI. When we run it on a device set to a different Language/Region (e.g. fr-CA), system UIs appear in the device language, not in English. Our preference would be to have all UI displayed "inside" the App appear in English.
To experiment, I created a single-view project that only does two things: request permission for notifications and show a MapKit map view, the two things we're most concerned with. I've tried the following, none of which appears to have the desired effect:
No localizations whatsoever (i.e. default when creating a new Xcode iOS project)
Added explicit "English - Development Language" localizaton (i.e. CFBundleLocalizations) and no other localizations
Tried setting the "AppleLanguages" in UserDefaults early in the App lifecycle (tried this in the AppDelegate and in a custom main.swift, similar to the solutions described in Setting "AppleLanguages" doesn't change app language)
let defaults = UserDefaults.standard
defaults.set(["en-CA"], forKey: "AppleLanguages")
defaults.synchronize()
Posts on the Apple Developer forums that suggest changing localization on the fly can/should not be attempted (e.g. https://forums.developer.apple.com/thread/85549, https://forums.developer.apple.com/message/36704#36704) but that's not exactly what we're going for. We don't want to change on the fly (e.g. in response to a language option inside our app), but rather just have all UIs, whether ours or from the system/frameworks appear only in English.
Is there some way to inform the system that the app is running in a specified localization that we've just overlooked?
Related
We are developing a React Native app supporting three languages. For various reasons, we must have specific language selection logic in the app and a language selector within the app.
In iOS 13 there is a new "Preferred language" selector in the system settings for the app. We would want the in-app language selector to change the preferred language, and conversely that the user could also change their language in the system settings.
How can I read/write the iOS "Preferred language" in a React Native app?
The preferred language setting cannot be explicitly fetched or set. Changing the preferred language appears to the app just like the whole system language is changed to the selected language.
We implemented in-app language selection so that the app uses the system language until the user explicitly changes the language in the app. Thus, if the user changes the preferred language, the app language changes. After the user changes the language in the app, the preferred language no longer matches the app language and changing it has no impact. (The user knows where to find the language setting after they have changed it once.)
You simply add it to Xcode (see image).
Then grab the languages in your app by using react-native-localize
There is an option in my app that will enable the user to change the language of the app which can be different from the system's language.
The app has to be localised according to that language instead of the device's language.
I have found couple of solutions like this one but I couldn't find a solution that will work for storyboards an base localisation.
How to achieve this?
I have to support different languages like English, Arabic, Japanese, etc., but the language changing option is available within the app itself. Earlier we have handled the right to left and left to right language changes in code.
From iOS 9 onwards, designed the UI with auto layout will be handled this properly, while changing the language in iPhone settings.
As per my requirement, I have changed the language within the app and updated the "AppleLanguages" key directly. But the storyboard is not updating properly. Once I force quit the app and relaunch it, then it working fine.
I have doubts in that,
Is there any solution to change this (language within the app) without restarting the app?
There is this (https://github.com/marmelroy/Localize-Swift/blob/master/README.md), a nice library I've been playing with which will change languages on the fly and not require you to restart the app. Does take some practice to figure out and uses NSObserver based strategy to update all the strings in the UI.
I'm fairly new to iOS development and I am porting an Android app to iOS 7. The Android app provides a screen that allows the user to change a number of non persistent settings. Because these are not saved, it doesn't seem appropriate to me to expose them, on iOS, as preferences via a settings bundle and the built-in Settings app. So I'm looking at an in-app settings screen, which I understand is allowed - but perhaps not encouraged - by Apple.
Some questions:
Am I correct that an in-App approach is allowed by Apple? Most example code seems to use settings bundles. Am I going to have problems when the app is submitted to the App Store?
I can put the settings UI in a simple UITableViewController, but is there an approved way to expose this to the user? XCode 5 doesn't provide a settings identifier (and icon) for toolbar buttons, and the "Info" identifier (letter i inside a circle) seems to have been dropped too. Should I use a custom icon? Are there any de facto standards?
I haven't seen this kind of UI element before on iOS but my exposure to the platform as a user is limited.
There is nothing wrong with doing an in-app preference (table)view. You won't be rejected for that (this point seems to be way too much exagerated outside the iOS community). There are guidelines that you can follow: iOS Human Interface Guidelines... or not. As long as you don't use private APIs (assuming you know how to access them anyway), you're fine! So you can use a custom icon, the "i" button, or any UI element that convey the reasonable meaning of providing access to more info/preference.
In your code, you can use the class NSUserDefaults (with the standardUserDefaults) to store your preferences.
Many apps have in-app settings. It's fine. Apple even states that it is fine. Just don't have both.
Use a custom icon. Many apps seem to use an icon that looks like a gear.
"Application has localized display name" = YES in Info.plist
Localized CFBundleDisplayName & CFBundleName in InfoPlist.strings
When I change the language of the whole device, it works. It changes the name of my app.
When I install it, the name is in the language of the device.
I manually change the app language from inside the app with NSUserDefaults language setting. Everything inside the app is perfectly localized whenever I change the language from inside the app. (Needs a restart of app)
But the app name does not change this way, the only way for it to change is, changing the device language.
Am I missing something? Is there a way to change the app name when the language is changed?
Unfortunately, I don't think you can.
iOS has no way to tell what language preference is set inside each application (well, it could, but it's not done that way).
Instead, it uses the system-wide setting to find and display the appropriate CFBundleDisplayName for every application.
Developing a custom language preference inside an app is also not the recommended way. Apple expects users to set their language of choice in the device's Preferences, not from inside individual apps (see here: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPInternational/Articles/InternatSupport.html#//apple_ref/doc/uid/20000278-SW1). As an example, there's no way to change Facebook's language from inside the app, but as soon as you change the device's global language setting, the Facebook app reflects the change.