|
文件扩展名 |
.csv |
|
API 扩展 |
csv |
|
导入 |
是 |
|
导出 |
是 |
|
复数形式支持 |
是 |
|
描述支持 |
是 |
|
格式选项 这些选项可以在文件上传和/或下载时指定。根据上传/下载方法(API、CLI、Repo同步等),它们可以在查询参数 |
key_index comment_index tag_column max_characters_allowed_column column_separator quote_char header_content_row enable_pluralization export_tags export_max_characters_allowed custom_metadata_columns export_key_id key_id_column |
CSV(逗号分隔值)是一种流行的文件格式,主要用于各种应用程序和程序中的数据传输。在CSV文件中,每一行是一个数据记录。每个记录由几个用逗号分隔的字段组成。 在导入之前,请确保CSV文件的每一行有三个字段,分别表示源内容、翻译和评论(可选)。
区域映射参数(类型为哈希映射)是必需的,以指定文档中每个区域对应的列。有关示例,请参见配置文件示例和API文档以获取上传信息。
格式选项
|
标识符 |
custom_metadata_columns |
|
类型 |
哈希 |
|
上传 |
是 |
|
下载 |
是 |
|
默认 |
[empty] |
|
说明 |
需要导入或导出的自定义元数据值的HashMap:
|
|
标识符 |
export_key_id |
|
类型 |
布尔值 |
|
上传 |
否 |
|
下载 |
是 |
|
默认 |
false |
|
说明 |
导出键字符限制以及键和翻译。 |
|
标识符 |
key_id_column |
|
类型 |
integer |
|
上传 |
否 |
|
下载 |
是 |
|
默认 |
[empty] |
|
说明 |
包含键的ID的列索引。列索引从1开始。 |
代码示例
boolean_key,"--- true " empty_string_translation,"" key_with_description,Check it out!This key has a description!(至少在某些格式中),这是这个键的惊人描述! key_with_line-break,"This translations contains a 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, "Only one kitten found." pluralized_key.other,"Wow, you have %s kittens!" pluralized_key.zero,"You have no kittens." sample_collection,"--- - first item - second item - third item " simple_key,Just a simple key with a simple message. unverified_key,This translation is not yet verified and waits for it.(在某些格式中,我们也导出这个状态)
文件结构
典型的.CSV文件结构:
1 (Key column), 2 (Translation column), 3 (Comment column) app_title, My Software Project, This is the main title apples.zero, one apple, my comment ...
配置示例
一个用于.CSV文件的.phrase.yml推送部分的示例:
push:
sources:
- file: "./multi.csv"
params:
update_translations: true
locale_mapping:
en:2
de:3
format_options:
comment_index:4
tag_column:5
此格式使用命名的类别来标识键的不同复数形式。以下类别作为复数形式保留:
.zero | .one | .two | .few | .many | .other
正确识别、保留和标记复数键的名称示例:
-
inbox.messages.notification.one
-
inbox.messages.notification.other
文件应遵循此结构:
1 (Key column), 2 (Translation column), 3 (Comment column) messages.zero, No messages received, messages.one, One message received, messages.other, %s messages received,