- in your source code, use the codes CFCopyLocalizedStringxxxxxx to get the strings you want
mystr = CFCopyLocalizedStringFromTable(CFSTR("Searching ...") , CFSTR("Localized"),NULL);
the ‘Localized‘ is the table name, in fact it’s the string file name Localized.string without the extension ‘.string‘, and ‘Searching…‘ is the key of the string you want to get, you could set the 2 values as you want, the tools genstrings will refer to the 2 values to generate the string table file “Localized.string" automatically.
- use the string table generation tool genstrings to generate the string table, in you shell,
% genstrings <sourcefile_name>
there will be string files in the target directory,
- if you add -d <target_dir>, after genstrings, the string files will be stored in target_dir
- if there are many line of CFCopyLocalizedStringxxxxx function with different table name parameter, genstrings will generate lots of string files
- add the string files into your Xcode project
- open information of the string file, press the “make localizable" button, and add localization files
- open each language of your string files and modify the values after the “=" mark, the content format of the file is “key" = “value"
- to test the result, change your language in the “System Performance"/"International" and run your application
- the default languages supported by Xcode of localization are few, if your language is not listed by Xcode localization, please refer to ISO’s definition, for example, “zh_TW" refers to Traditional Chinese, “zh_CN" refers to Simiplified Chinese