We are in process of localizing our application. Before I get to my question, some background and context behind the question.
Background: Our web application allows user to select the preferred language along with preferred format in which they want to see the data that is displayed to them. Now when we are trying to localize our application we ideally want to retain the same behavior for our application where we honor the langugae and format they have selected on web and discard the language/format on device.
Question: From what I understand once we localize our application (by adding strings and lproj folders) and if the device is running the language that we support, the strings will automatically be translated and shown to user. I dont want this to happen. I have an idea on how I can achieve this by writing a wrapper on NSLocalizedString macro and manually fetching the strings by checking the locale obtained from our server. My questions as below:
- Is this recommended? Is there a recommended way of solving this problem? I am sure we are not the only ones who will have this problem. A lot of enterprise applications would have faced this.
- I still see a place which we wont be able to handle with above approach. The place is the Info.plist file of our application. How do we handle this?
As a general rule I recommend that you use the system’s localisation machinery and have the app run in the language configured on the device. Doing anything else tends to cause problems, some of which are hard to solve. Specifically, the system has its own idea of what language your app is running in; if you ignore that you can end up display mixed localisation.
This post explains that problem in more detail.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"