0

I set up a test app with a localizable.strings file. In the project settings i add English-United Kingdom, french, and french-france

The "french" strings file works in the app. I see the localized version when i choose the language "france"

However, when i set language to English and Region Form to "United Kingdom", im expecting to see the string that comes from the en-GB strings file. Im seeing the English version. I'm obviously missing something here. Same when i use "French - France". i would expect it to use fr-FR version of the strings file.

I've got French-France, French-switzerland, etc. How do i implement these?

Thanks for the help.

MobileGuy
  • 1,232
  • 1
  • 11
  • 21
  • Is this ios (iPhone) ?, further please post the names of your string files and the location (Project root?) – AlexWien Dec 05 '12 at 18:06
  • 1
    iPhone doesn't read country-specific localized files, only OS X does that. – Filip Radelic Dec 05 '12 at 18:13
  • Yeh i just found that out >.< why does XCode let me create them? You may only edit a comment every 5 seconds.(click on this box to dismiss)Important: In iOS, the bundle interfaces do not take dialect or script information into account when looking for localized resources; only the language designator code is considered. Therefore if your project includes language-specific project directories with both a language and region designator, those directories are ignored. The bundle interfaces in Mac OS X do support region designators in language-specific project directories. – MobileGuy Dec 05 '12 at 18:19

1 Answers1

0

I had a problem that I solved by explicitly setting the localization directory from which to get the strings (my issue link and text below).

iOS Localizable.strings not being retrieved from BASE file

NSString *path = [[NSBundle mainBundle] pathForResource:[[NSLocale preferredLanguages] objectAtIndex:0] ofType:@"lproj"];
if (path == nil)
{
    path = [[NSBundle mainBundle] pathForResource:@"Base" ofType:@"lproj"];
}

NSLocalizedStringFromTableInBundle(@"TAB_TITLE_Camera", @"Localizable", [NSBundle bundleWithPath:path], @"");

If you have a specific localization directory that you want to retrieve your strings from, you could replace

pathForResource:

with en-GB, fr-FR, or whatever other directory name you need.

I believe it's suppose to, or at least it should, select the proper localization directory, but it doesn't seem to do that which is why I came up with this solution.

Community
  • 1
  • 1
GRW
  • 605
  • 12
  • 27