|
文件扩展名 |
.strings |
|
API 扩展 |
strings |
|
导入 |
是 |
|
导出 |
是 |
|
复数形式支持 |
否 |
|
描述支持 |
是 |
|
格式选项 上传和/或下载文件时可以指定的这些选项。根据上传/下载方法(API、CLI、Repo 同步等),它们可以在查询参数 |
convert_placeholder, include_pluralized_keys, multiline_comments |
Strings Resource 文件是用于 iOS 和 OS X 应用程序的标准本地化文件。Strings Resource 文件由通过 = 符号连接的键值对组成。它类似于 Java Properties 文件,不同之处在于键和值都用双引号括起来,并且每个键值对都以分号结尾。
如果使用第三方工具(例如 genstrings)生成 Strings Resource 文件,则可能会出现具有重复键 Strings 的文件。复制的键通常不会有问题,但建议在开始翻译流程之前将其删除。
格式选项
|
标识符 |
convert_placeholder |
|
类型 |
布尔值 |
|
上传 |
否 |
|
下载 |
是 |
|
默认 |
false |
|
说明 |
占位符将被转换为匹配格式的特定要求。示例: |
|
标识符 |
multiline_comments |
|
类型 |
布尔值 |
|
上传 |
否 |
|
下载 |
是 |
|
默认 |
false |
|
说明 |
启用后,多行注释将呈现在 .Strings 文件中。 |
代码示例
"boolean_key" = "--- true\n"; "empty_string_translation" = ""; /* 这是此键的精彩描述! */ "key_with_description" = "Check it out!This key has a description!(At least in some formats)"; "key_with_line-break" = "This translations contains\na line-break."; "nested.deeply.key" = "Wow, this key is nested even deeper."; "nested.key" = "This key is nested inside a namespace."; "null_translation" = ""; "pluralized_key.one" = "仅找到一个复数形式。"; "pluralized_key.other" = "哇,你有 %s 个复数形式!"; "pluralized_key.zero" = "你没有复数形式。"; "sample_collection" = "---\n- first item\n- second item\n- third item\n"; "simple_key" = "只是一个带有简单消息的简单键。"; "unverified_key" = "此翻译尚未未验证,正在等待验证。(在某些格式中,我们也会导出此状态)";
iOS Localizable Strings 的复数形式
对于复数值,添加以下后缀运算符:
"messages.zero" = "未收到消息"; "messages.one" = "收到一条消息"; "messages.other" = "%s messages received";