Localising "dynamic" string resources in code
Localising "dynamic" string resources in code
- Subject: Localising "dynamic" string resources in code
- From: Luc Van Bogaert <email@hidden>
- Date: Wed, 10 Oct 2012 11:25:21 +0200
Hi,
I'm in the process of localising my application, and I'm having a problem getting some of the string resources in my code localised. In several places in my code, I'm using this kind of structure to implement "dynamic" menu items:
if (action == @selector(toggleInspectorPanel:)) {
if ([(NSObject *)item isKindOfClass:[NSMenuItem class]]) {
[(NSMenuItem *)item setTitle:([self isInspectorCollapsed] ?
NSLocalizedString(@"Show Inspector Panel", @"Menu item to show the Inspector panel") :
NSLocalizedString(@"Hide Inspector Panel", @"Menu item to hide the Inspector panel"))];
return ![self.inspectorSplitter isAnimating];
}
Even though both string resources exist and have been translated in my Localized.strings files, I'm always seeing the original English text when I run my localized application.
The exact same problem occurs with string resources that are provided to some control in my interface (eg. e dropdown menu) through a binding:
- (NSArray *)startupModeNames
{
return [NSArray arrayWithObjects:
NSLocalizedString(@"Sketch Mode", @"Title for SketchBook startup mode"),
NSLocalizedString(@"Design Mode", @"Title for SketchBook startup mode"),
NSLocalizedString(@"SketchBook Mode", @"Title for SketchBook startup mode"),
nil];
}
Here also, I'm only seeing the original English text instead of the localized version that's available in the Localized.strings file.
All the other string recources in my code get translated correctly.
Could anyone please help me find out what it is I'm missing here?
Many thanks,
--
Luc Van Bogaert
_______________________________________________
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