Localization of System Preferences Pane
Localization of System Preferences Pane
- Subject: Localization of System Preferences Pane
- From: MacProjects <email@hidden>
- Date: Tue, 10 Nov 2009 23:51:28 +0200
Hello!
It's first time trying to localizae a prefpane... some minutes and I'm already stuck.
Suppose I want to deliver a preference pane with interface in English, German, Latvian, the latter beeing mostly used.
For testing purposes:
I'm creating a new Preference pane project under Xcode 3.2.1
Creating localizations for
InfoPlist.strings
MyProjPref.xib
Localizable.strings
named English, German, Latvian
In MyProjPref.xib for each language I create a Label (NSTextField) with a value that represents the corresponding language, e.g., "This is English text", "This is Deutsch text", "This is Latviešu text".
In Localizable.strings I'm creating
someword = "English word";
someword = "Deutsch word";
someword = "Latviešu word";
and the only code is
- (void) mainViewDidLoad
{
NSLog(NSLocalizedStringFromTableInBundle(@"someword",nil,[NSBundle bundleForClass:[self class]],nil));
}
Using OS 10.6.2.
The Latvian language is the first language set in System Preferences : Language & Text : "Drag languages into order you prefer" list, then comes English, then Deutsch. However firing up preference pane opens English localization nib and NSLog writes "English word". If I change list and order Deutsch as the second language, then it fires up. Thus - Latvian in the first position is ignored and the next language is used.
I do understand that the System Preferences.app itself isn't localized in Latvian. Is it the reason why I'm not able to use "other than apple supported system wide localisation language" in System Preferences.app prefpane?
If so, what would be the solution?
I.e. leaving xib unlocalized, and using code like
- (void) mainViewDidLoad
{
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
NSArray * languages = [defaults objectForKey:@"AppleLanguages"];
if([[languages objectAtIndex:0] compare:@"lv"] == NSOrderedSame) {
NSLog(@"Latvian!\n");
//set labels value
[labelField setStringValue:@"text in latvian"];
}
// else if en, de....
}
looks bad... I have to check for each and every field, view, layout, cell and "you know what more" in the nib that the value passed in such programmatical way isn't cropped in the element etc. which means more and more and more code. And more.
There is no problem localizing "usual" cocoa based applications in any other language including Latvian the way Apple ment for developers to do this. What about sysprefs?
Many thanks in advance,
Regards, Reinis
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden