XCode 5 localizing app name on the fly - ios

"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.

Related

How to get/set the iOS "preferred language" from a RN app?

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

Localisation inside an iOS app without changing the system Language

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?

Change app name programmatically

I want to change the app name based on the app language selected by the user & not the system language.
Is there any solution?
Even if it is doable using private API, I would like to know.
I know there is only one way using plist but as it is read only, I won't be able to update the plist file.
VImp Note, I want to change as per app language and not as per system language.
You can localize your Info.plist file.
Just select Info.plist file,and in File Inspector,click Localize... button in the Localization section.
You can't change your apps name programmatically.Because the name is stored in the info.pist which resides in you apps main bundle is read only you can not change it. You only option is to use the localized functionality provided by iOS based on the system language.

Can a renaming on an iOS application be done in one locale only?

I have an iOS app that's used internationally.
This app supports push-notifications.
The app is used internationally.
however, recent legal problems force me to change its name in the U.S.
I don't want to change its name globally, just the U.S.
Whta's the minimal set of action I can take to get there as fast as I can?
Can I change the application name and some of its UI for a certain locale only? (ENG-US)
do must I deploy a new app altogether alongside the old one?
Note I must keep the "british" locale with the old UI, but must rename the application name and change some of its UI only for the U.S.
Is that possible? or will I be forced to deploy a new app just for the U.S.?
Thank you
Yes the CFBundleDisplayName and CFBundleName are localizable. You need to add your localizations in an InfoPlist.strings file and add specific localizations there.

iOS: Is there any way to fake the user's locale?

I'm interested in allowing my users to choose the language / locale my app appears to them in. I have figured out how to load the right bundle, choose the correct strings files, etc. However, some system items I still seem to have no control over. Switch controls, for example.
Is there any way for me to tell the system that this app should now behave in a specific language, rather than the user's current system setting?
The least hacky way is via NSUserDefaults: The locale is determined by AppleLocale (the locale ID as a string) and the language is determined by the first match in AppleLanguages (an array of language IDs); your app can override these defaults for your app only. To check if it's overridden by your app, you can use something like [defaults persistentDomainForName:[[NSBundle mainBundle] bundleIdentifier]] objectForKey:#"AppleLocale"]. To remove the override, use -removeObjectForKey:.
Whichever way you do it, you'll probably have to relaunch the app when changing languages; OS X and iOS apps simply aren't designed to change language at runtime (on OS X, only newly launched apps see the language change; on iOS the system kills all apps to change language).
I added this feature to make switching languages easier for development/testing; I have no idea whether this will fail the App Store review process.

Resources