0

From first view of the application , User will select a language i.e English, french etc. I want that my whole application will run in that language selected by user.

Doing r&d, I have found that i have to use a .strings file for every language. In that file, I have to add translated strings in a key-Value pair. My question is how to use those .strings files according to the selected language. For Eg. i have to use .strings file that contains all translated strings in french If French language will be selected from the first page.

DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • Apple say it best: https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/BPInternational.html#//apple_ref/doc/uid/10000171i – trojanfoe Oct 28 '13 at 12:04
  • 2
    Why do you want to do things differently? IMHO this is unexpected behaviour, as a user I expect the app to start with language that I've set in Preferences.app. For that, you don't need to do anything. Even worse: if your app wants me to select a language I immediately assume it's of poor quality. – DarkDust Oct 28 '13 at 12:05
  • Also, your question is tagged BOTH `ios` and `osx`. Which is it? – DarkDust Oct 28 '13 at 12:08
  • @DarkDust It is an osx app I do not need the app to be localized according to the language in the preferences. It is an feature in the app so i need to implement that in my app. I would really appreciate if you will suggest me any method to use any particular .strings file from various .strings file. – Hitesh Bhardwaj Oct 28 '13 at 17:28

2 Answers2

1

The solution is probably: don't do this.

The user is expecting that the applications use the languages and locale settings that he has already chosen in the system. Making them do the same choice when your app starts again looks "cheap" and unexpected.

Apple doesn't provide you an API to do the locale change at runtime, so you'd probably either have to deal with private APIs or other nasty hacks. This in turn means you're likely to run into various issues like wrong number and/or date formatting.

DarkDust
  • 90,870
  • 19
  • 190
  • 224
0

Check out this link it will help you to fetch manually Localizable.string file as per your Langauge selection. You have to manage this NSDictionary to your AppDelegate Or your SuperViewcontroller. (Your all UIViewController extend the SuperViewController).

Community
  • 1
  • 1
Hitarth
  • 1,950
  • 3
  • 27
  • 52
  • This would have a lot of downsides: first, you'd have to make sure this dictionary is available everywhere you need localization. Second, Apple doesn't know about this and thus will still produce error messages and stuff in the current system's locale. Third, this also applies to things like number and date formatting: for example, you might end up with english text but german number formatting which has the meaning of `,` and `.` reversed. – DarkDust Oct 28 '13 at 13:03