文件扩展名 |
.strings |
API 扩展 |
strings |
导入 |
是 |
导出 |
是 |
复数形式支持 |
否 |
描述支持 |
是 |
格式选项 |
convert_placeholder、include_pluralized_keys、multiline_comments |
Strings 资源文件是用于 iOS 和 OS X 应用程序的标准本地化文件。Strings 资源文件由键-值对组成,键-值对用 =
符号连接。它与 Java 属性文件类似,只是键和值都被双引号括起来,而且每个键-值对都以分号结尾。
如果使用第三方工具(例如 genstrings)生成 Strings 资源文件,则 可能有Stringsrings复制的文件。复制键通常没有问题,但建议在开始翻译过程之前删除它们。
格式选项
标识符 |
convert_placeholder |
类型 |
布尔值 |
上传 |
否 |
下载 |
是 |
默认 |
false |
说明 |
将转换占位符以匹配格式的特定要求。例如: |
标识符 |
multiline_comments |
类型 |
布尔值 |
上传 |
否 |
下载 |
是 |
默认 |
false |
说明 |
启用后,将在 .strings 文件中呈现多行注释。 |
代码示例
"boolean_key" = "--- true\n"; "empty_string_translation" = ""; /* 这是此键的惊人描述!*/ "key_with_description" = "看看!This key has a description!(至少在某些格式中)"; "key_with_line-break" = "此翻译包含\na 换行符."; "nested.deeply.key" = "哇,此键嵌套得更深."; "nested.deeply.key"": "哇,此键嵌套得更深.", "nested.key" = "此键嵌套在命名空间内.";"nested.key"": "此键嵌套在命名空间内.", "null_translation" =""; "pluralized_key.one" = "Only one pluralization found."; "pluralized_key.other" = "Wow, you have %s pluralizations!"; "pluralized_key.zero" = "You have no pluralization."; "sample_collection" = "---\n- first item\n- second item\n- third item\n"; "simple_key" = "只是一个带有简单信息的简单键."; "simple_key]: "只是一个带有简单信息的简单键.", "未验证_key" = "此翻译尚未验证并等待它."此翻译尚未验证并等待它。(In some format we also export this status)");
iOS Localizable Strings 的复数
对于复数值,添加以下后缀运算符:
"messages.zero" = "No messages received"; "messages.one" = "One message received"; "messages.other" = "%s messages received";