Re: Internationalized text
Re: Internationalized text
- Subject: Re: Internationalized text
- From: Chris Hanson <email@hidden>
- Date: Mon, 29 Sep 2003 11:08:14 -0500
NSString uses Unicode natively, so you can just store everything in
NSStrings and it should come across just fine.
Since all of Cocoa including the AppKit uses NSStrings you don't have
to worry about things like font/script synchronization, keeping track
of style runs if you want to mix scripts, etc. Everything uses Unicode
natively, so the user can just choose a Greek keyboard layout and enter
Greek or Japanese or Cyrillic text and you'll get real Greek or
Japanese or Cyrillic Unicode characters.
XML files, such as plist files, also use one Unicode encoding or
another so the property list representation of, say, an NSDictionary of
NSStrings will come across just fine too. (You can create one using
the class methods in the NSPropertyListSerialization class.)
The only trickiness is that Objective-C source code is defined to be
7-bit ASCII, same as ANSI C. So you can't reliably put 8-bit
characters into your application's source. If you want to do that, you
should use the localization mechanism. You put the full Unicode string
in a Localizable.strings file, and use the NSLocalizedString or
NSLocalizedStringFromTable functions in your source code with an ASCII
"key" string. (These are under Foundation>General>Functions>Bundles in
Cocoa Browser.)
-- Chris
--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Mac OS X Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
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.