在我的“ViewController.swift”中,我有一个本地化的字符串:
TheOutLabel.text = NSLocalizedString("hello", comment: "The \"hello\" word")
Run Code Online (Sandbox Code Playgroud)
在终端中,为了生成“Localizable.strings”文件,我输入:
cd Base.lproj/; genstrings ../*.swift; cat Localizable.strings
Run Code Online (Sandbox Code Playgroud)
并得到以下结果:
??/* The \"hello\" word */
"hello" = "hello";
Run Code Online (Sandbox Code Playgroud)
打字时od -c Localizable.strings,我得到:
0000000 377 376 / \0 * \0 \0 T \0 h \0 e \0 \0
0000020 \ \0 " \0 h \0 e \0 l \0 l \0 o \0 \ \0
0000040 " \0 \0 w \0 o \0 r \0 d \0 \0 * \0
0000060 / \0 \n …Run Code Online (Sandbox Code Playgroud)