• 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: objectForKey crashes for string formats
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objectForKey crashes for string formats


  • Subject: Re: objectForKey crashes for string formats
  • From: Lorenzo <email@hidden>
  • Date: Thu, 22 May 2003 21:22:52 +0200

Very Veeeeeery cool.
I didn't know. And the developer can save the strings to the file using
genstrings. So fine! Imagine, I used an AppleScript to take all the strings
from the code.m files then I built an external XLM file, then localize the
language used, then the language folder, then the string file, build the
dictionary... a lot of work. Instead this is so short... Fine, very very
fine.

Thank you so much.

Best Regards
--
Lorenzo
email: email@hidden

> Date: Thu, 22 May 2003 09:21:46 -0400
> Subject: Re: objectForKey crashes for string formats
> From: Chris Hanson <email@hidden>
> To: email@hidden
>
> On Thursday, May 22, 2003, at 03:35 AM, Lorenzo wrote:
>> I use a NSDictionary to localize my software in different languages.
>
> Why not use Cocoa's built-in support for localization? It's much
> cleaner, and requires virtually no work on your part while developing
> your software.
>
> For instance, you would write
>
> errorFormat = NSLocalizedString(@"The file \"%1$@\" cannot be saved."
> @"Can't save file. (filename)");
>
> and then the appropriate message would be picked up from the current
> language's Localizable.strings file, if one exists. If one doesn't,
> the message itself will be passed through. The second string is a
> comment; when you run genstrings on your code to generate an initial
> Localizable.strings file from your NSLocalizedString declarations, this
> comment is added to the file.
>
> The "1$" above indicates which argument should be substituted. For
> instance, English writes given and then family name, but Japanese
> writes family and then given name. You could write
>
> nameFormat = NSLocalizedString(@"My name is %1$@ %2$@.",
> @"full name (given, family)");
>
> and then in your Japanese.lproj/Localizable.strings, have
>
> /* full name (given, family) */
> "My name is %1$@ %2$@." = "My name is %2$@ %1$@."
>
> and the Right Thing would happen when you wrote
>
> myName = [NSString stringWithFormat:nameFormat, givenName,
> familyName];
>
> Cool, huh?
>
> -- Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: objectForKey crashes for string formats
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Re: Control characters in an NSAttributed string?
  • Next by Date: Re: NSTableView - howto implement textShouldBeginEditing:
  • Previous by thread: Re: objectForKey crashes for string formats
  • Next by thread: Re: objectForKey crashes for string formats
  • Index(es):
    • Date
    • Thread