Re: Localization...
Re: Localization...
- Subject: Re: Localization...
- From: "Michael Ash" <email@hidden>
- Date: Mon, 3 Nov 2008 01:54:45 -0400
On Mon, Nov 3, 2008 at 12:15 AM, Markus Spoettl
<email@hidden> wrote:
> On Nov 2, 2008, at 8:04 PM, Chris Idou wrote:
>>
>> [[NSBundle bundleForClass:[self class]]
>> localizedStringForKey:@"kMDItemFSLabel" value:@"nothing here"
>> table:@"MetaData"]
>>
>> MetaData.strings ends up in my English.lproj and get info says it is an
>> English localization. But the code returns "nothing here".
>>
>> I've also tried:
>>
>> NSLocalizedStringFromTable(@"kMDItemFSLabel", @"MetaData",
>> @"kMDItemFSLabel")
>>
>> But that doesn't work either. Am I missing something?
>
>
> When I can't get a specific localized string (or any string in a strings
> file) to be picked up correctly it's always a syntax error in the strings
> file. You'll get no warning of any kind in such a case, it just doesn't
> work.
And note that .strings files are, despite their appearances, just
regular old property lists. The UTF-16 with the line-by-line equals
signs is just the old-style plist format. This gives you some useful
properties:
- The plutil -lint command will tell you if there is a syntax error,
and where it is if there is one.
- You can also open the thing with Property List Utility and see if it
errors, or use NSPropertyListSerialization.
- You can convert it to the more standard XML format and work with it
that way. (However beware, as I don't believe there is a standard tool
to convert *back*, old style plists being read-only in the frameworks
at this point. However for the basic structure of .strings files,
writing a bit of code to do the conversion would not be too
difficult.)
Mike
_______________________________________________
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