Localize the multi-language strings

Posted on

  1. 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.

  2. 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
  3. add the string files into your Xcode project
  4. open information of the string file, press the “make localizable" button, and add localization files
  5. open each language of your string files and modify the values after the “=" mark, the content format of the file is “key" = “value"
  6. to test the result, change your language in the “System Performance"/"International" and run your application
  7. 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



WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )


您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s