An important part of the localization process is to translate all of the text strings displayed by your application. By their nature, strings located in other resource files (such as nib files) are readily localizable and do not require any additional work. Strings embedded in your code, however, must be extracted into strings resource files so that they can be localized. For example, if you use a generic alert panel to communicate information to the user, you might need different message strings for different situations. Because they are seen by end users, the strings you display in that alert panel should be loaded from a resource file and not hard-coded into your source files.
Strings files provide a place for you to store localizable string resources in your application bundle. A typical application has at least one strings file per localization, that is, one strings file in each of the bundle’s .lproj subdirectories. The name of the default strings file is Localizable.strings but you can create strings files with other names too. To create other strings files automatically, specify a table name when loading the string and the genstrings tool creates a file with that name for you.
Note: It is recommended that you save strings files using the UTF-16 encoding, which is the default encoding for standard strings files. It is possible to create strings files using other property-list formats, including binary property-list formats and XML formats that use the UTF-8 encoding, but doing so is not recommended. For more information about the standard strings file format, see “Creating Strings Resource Files.” For more information about Unicode and its text encodings, go to http://www.unicode.org/ or http://en.wikipedia.org/wiki/Unicode.
The standard strings file format consists of one or more key-value pairs along with optional comments. (The string loading routines can also parse property list formats where the top-level node is a dictionary and the keys and values of that dictionary are both strings.) The key and value in a given pair are strings of text enclosed in double quotation marks and separated by an equal sign. When you need to display a string, you pass in the appropriate key string to one of the available string-loading routines. What you get back is the matching value string containing the text translation that is most appropriate for the current user.
Creating Strings Resource Files
Getting Strings from a Strings File
Advanced Strings File Tips
Last updated: 2007-09-04