Localization of The PlatformIO Documentation

未关闭
#409 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
文档
描述清晰度
需要澄清
活跃度
冷清
技术栈
python

调研方向

此 issue 宣布了外部项目 platformio-docs-l10n,而不是说明 platformio-docs 中的变更。请查看 ci-sphinx-update-pot.yml 和 ci-gettext-update-po.yml,以及 Crowdin 项目,以了解翻译工作流;此处未定义完成标准或具体变更。

由索引模型根据 Issue 内容生成。

描述

Announcement

Hello PlatformIO Community,

I am the author of the @localizethedocs organization. And I’m glad to announce that the 🎉 platformio-docs-l10n 🎉 project is published now:

The goal of this project is to translate The PlatformIO Documentation into multiple languages. Translations are contributed via the Crowdin platform, automatically synchronized with the GitHub repository, and can be previewed on GitHub Pages.

How to Contribute Translations?

To contribute the translations, just follow the following steps:

  1. Create an account on Crowdin Enterprise if you don't have one.
  2. Log in and go the platformio-docs-l10n project.
  3. Choose the language you would like to contribute.

If translators want to translate a language that is not yet supported, they just need to open a new issue to request the new language. Once the requested language is added, they can begin translating.

How to Keep Content Up-to-date?

An FAQ that is sure to come up in the community is: How to keep translations up-to-date?

First and foremost, in my opinion, the focus should be on how to keep the "Translatable Content (msgid)" up-to-date, rather than the "Translations (msgstr)". I will focus on the most critical part of the whole infrastructure here.

In short, the ci-sphinx-update-pot.yml workflow will be executed weekly to check the upstream project for any required updates to the document content, which in turn triggers the update of the .pot files. If an update is needed, a Pull Request (PR) is automatically created to merge into the l10n branch. For example:

Once those PRs are merged, the ci-gettext-update-po.yml workflow will be triggered to merge the updated content from the .pot files into the .po files for each language. This is essentially how @localizethedocs keeps the "Translatable Content" up-to-date.

Therefore, the core responsibility of the code maintainers, besides ensuring the stable operation of the scripts and workflows, is to regularly check whether there are any pending PRs that need to be merged.

How to Reuse Translations?

If the upstream project or anyone wants to reuse the translated .po files prepared by the platformio-docs-l10n project, they can clone the .po files from the po/${VERSION} branch by using the following command:

git clone --depth=1 --branch=po/${VERSION} https://github.com/localizethedocs/platformio-docs-l10n.git docs/locale

Those po/${VERSION} branches are created to facilitate reusage by the upstream project. For instance, the zh_TW documentation for the latest version can be generated using the commands below:

BRANCH=develop
VERSION=latest
LANGUAGE=zh_TW
BUILDER=html
VENVDIR=$(pwd)/.conda

# Prepare the repository and environment
git clone --branch=${BRANCH} --depth=1 https://github.com/platformio/platformio-core.git platformio-core
cd platformio-core
conda create --prefix ${VENVDIR} --yes
conda activate ${VENVDIR}
conda install python=3.14 -c conda-forge -c nodefaults --yes
export PYTHONNOUSERSITE=1
python -m ensurepip --default-pip
cat << 'EOF' > requirements.txt
sphinx
sphinx-rtd-theme==3.0.2
sphinxcontrib-googleanalytics
sphinx-notfound-page
sphinx-copybutton
restructuredtext-lint
EOF
python -m pip install -r requirements.txt

# Clone the .po files to the 'locale' directory
git clone --branch=po/${VERSION} --depth=1 https://github.com/localizethedocs/platformio-docs-l10n.git docs/locale

# Build the documentation
pushd docs
sphinx-build \
    -b ${BUILDER} \
    -D language=${LANGUAGE} \
    -D locale_dirs=locale \
    -D gettext_compact=0 \
    -D gettext_additional_targets=index,literal-block,raw \
    . \
    ./_build/${LANGUAGE}
popd

# Preview the documentation
firefox docs/_build/${LANGUAGE}/index.html

Related Discussions

There were discussions about translating The PlatformIO Documentation:

Therefore, I believe the platformio-docs-l10n project should be able to serve this purpose.

主要语言
Python
星标
288
派生
361
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

platformio/platformio-docs 的其他 Issue

查看 platformio/platformio-docs 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。