首页>开发手册>Symfony>Contributing Translations
Symfony 手册目录展开/收起

Symfony 7.4 LTS

Contributing Translations

本文目录展开

官方英文资料(未自动翻译);本文按官方对应版本整理,保留说明和代码。站内处理包括移除站点导航、还原代码格式及调整链接。

Some Symfony components ship messages that are shown to end users, such as validation errors ("This value is not a valid timezone."). These messages are translated into dozens of languages by the community, and new messages are added regularly, so there are always missing translations you can help with.

Tip

Quick reference

Translations live in the symfony/symfony repository as XLIFF files (*.<locale>.xlf). Find the messages missing in your language, translate the <target> tags, and open a pull request against the oldest maintained branch.

How to Contribute a Translation

Imagine you speak English and Swedish and want to add the missing Swedish translations.

Step 1. Translations are always contributed to the oldest maintained branch (check the Symfony Releases page). Browse or check out that branch of the symfony/symfony repository.

Step 2. Translation files use the XLIFF format and live in these directories:

  • src/Symfony/Component/Form/Resources/translations/
  • src/Symfony/Component/Security/Core/Resources/translations/
  • src/Symfony/Component/Validator/Resources/translations/

For Swedish, look at the *.sv.xlf files. If the file for your language doesn't exist yet, create it by copying the English one (e.g. validators.en.xlf).

Tip

The Symfony Translations Status site shows, per language, which translations are still missing.

Step 3. Compare your language file with the English one and add the missing messages. Each entry keeps the English <source> and translates the <target>:

<trans-unit id="94">
    <source>This value should be between {{ min }} and {{ max }}.</source>
    <target>Detta värde bör vara mellan {{ min }} och {{ max }}.</target>
</trans-unit>

Step 4. Open a pull request against the symfony/symfony repository. The process is the same as for code or docs.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
Version

来源与许可

Symfony documentation contributors。本资料采用 CC BY-SA 3.0;本页为官方资料的站内整理版本,并非框架官方网站。 许可说明

Symfony 官方文档 · 原文来源 · 打开在线代码运行