支持文件类型 (Strings)

.YAML - Symfony (字符串)

文本由 Phrase Language AI 从英语机器翻译而得。

文件扩展名 

.yml, .yaml

API 扩展 

yml_symfony

导入 

导出 

复数形式支持 

描述支持 

Symfony 是一个高性能的 PHP 框架,由各种预定义的 PHP 组件组成。 使用 Symfony 构建的应用程序的本地化可以通过文件格式进行,例如 .XLIFF、.YAML 和 PHP 数组。Symfony 开发团队建议在小型本地化项目中使用 .YAML,而在较大或更复杂的项目中使用 .XLIFF。与基于 XML 的 .XLIFF 相比,.YAML 更易于人类阅读,数据嵌套是通过缩进实现的,而不是使用显式标签。根据 .YAML 约定,在准备 .YAML 进行翻译时,请确保使用常规空格而不是 TAB 键来正确缩进。

复数

Symfony i18n 框架的复数形式规则遵循 ICU 信息 格式。在项目中使用 ICU 信息格式之前,必须通过在 项目设置 窗口的 高级 选项卡中选择 "启用 ICU 信息格式支持" 来启用它。

启用后,使用 选择 函数语法传递多个参数,添加 复数 规则:

file:translations/messages+intl-icu.en.yaml

key: >-

  {files, plural,

     =0 {没有收到消息}

     one {收到一条消息}

     =other {收到#条消息}

  }

添加多个规则以应对不同的数字:

=0
=1
=2
=n

YAML文档已重建,所有复数形式都放置在适当的键下。

代码示例

---
boolean_key: true
empty_string_translation: ''
key_with_description: 快来看看!这个键有一个描述!(至少在某些格式中)
key_with_line-break: |-
  此翻译包含
  换行。
嵌套:
  深度:
    key: 哇,这个键嵌套得更深了。
  key: 这个键嵌套在一个命名空间中。
null_translation:
pluralized_key:
  one: 只找到一个复数形式。
  other: 哇,你有 %s 个复数形式!
  zero: 你没有复数形式。
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.(In some formats we also export this status)
这篇文章有帮助吗?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.