Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page >


Localized Resources

If a bundle is to be used in more than one part of the world, its resources may need to be customized, or localized, for language, country, or cultural region. For example, an application may need to have separate Japanese, English, French, and Swedish versions of the character strings that label menu commands. An application may also need to accommodate regional language variation—British and American English, for example.

Bundles solve this problem by grouping resources together into directories named for their region and language with the extension.lproj. Region-specific resource directories should take their names from the ISO 3166 standard for country codes, and the ISO 639 standard for language codes (see http://www.iso.ch). You would place resources specific to the dialect of French spoken in France in a directory named fr_FR.lproj, whereas you would place resources specific to Canadian French in a directory named fr_CA.lproj. Localized resources that need not be region specific should be placed in directories named simply for the language, such as English.lproj or Japanese.lproj. These localized resource directories are then placed in a directory named Resources within the bundle’s Contents directory. Nonlocalized (global) resources are kept in the top level of the Resources directory. See the section “Anatomy of a Bundle” for an example of a complex bundle’s file system layout.

The user determines which set of localized resources are actually used by the bundle at runtime. Bundle-related system routines rely on the language preferences set by the user in the Preferences application. Preferences lets users create an ordered list of available regions so that the most preferred region is first, the second most preferred region is next, and so on. When a bundle is asked for a resource file, it returns the file-system location of the resource that best matches the user’s region preferences. See the section “Search Algorithm” for details on the exact process Mac OS X uses to locate a bundle resource. See the section “Localizing File System Names” for information on localizing bundle names. Also see the chapter “Internationalization” for more detailed information about the naming of .lproj directories.



< Previous PageNext Page >


Last updated: 2003-08-21

Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2003 Apple Computer, Inc.
All rights reserved. | Terms of use | Privacy Notice