• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Localization...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Localization... (From: Chris Idou <email@hidden>)
 >Re: Localization... (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Porting SetupComm function in Mac
  • Next by Date: Re: Removing 4 pixels
  • Previous by thread: Re: Localization...
  • Next by thread: Re: Localization...
  • Index(es):
    • Date
    • Thread