-
-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Localization of The NumPy Documentation #31039
Description
Announcement
Hello, NumPy Community,
I am the author of the @localizethedocs organization. And I’m glad to announce that the 🎉 numpy-docs-l10n 🎉 project is published now:
- 🚀 Preview: numpy-docs-l10n
- 🌐 Crowdin: numpy-docs-l10n
- 🐙 GitHub: numpy-docs-l10n
The goal of this project is to translate The NumPy 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 to the project, just follow the following steps:
- Create an account on Crowdin Enterprise if you don't have one.
- Log in and go the numpy-docs-l10n project.
- 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 Reuse Translations?
If the upstream project or anyone wants to reuse the translated .po files prepared by the numpy-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/numpy-docs-l10n.git docs/localeThose po/${VERSION} branches are created to facilitate reusage by the upstream project. For instance, the zh_TW documentation for the main version can be generated using the commands below:
BRANCH=main
VERSION=main
LANGUAGE=zh_TW
BUILDER=html
# Prepare the repository and environment
git clone --branch=${BRANCH} --depth=1 https://github.com/numpy/numpy.git numpy-docs
cd numpy-docs
conda create --prefix ./.conda --yes
conda activate ./.conda
conda install gcc gxx python=3.13 doxygen graphviz binutils ninja -c conda-forge -c nodefaults --yes
export PYTHONNOUSERSITE=1
pip install -r requirements/doc_requirements.txt
# Generate relates notes with towncrier
NP_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
towncrier build --version ${NP_VERSION} --yes
# Generate C++ API documentation with doxygen
cd doc
python preprocess.py
doxygen build/doxygen/Doxyfile
cd ..
# Clone the .po files to the 'locale' directory
git clone --branch=po/${VERSION} --depth=1 https://github.com/localizethedocs/numpy-docs-l10n.git doc/source/locale
# Build the documentation
sphinx-build \
-b ${BUILDER} \
-D language=${LANGUAGE} \
-D locale_dirs=locale \
-D gettext_compact=0 \
-D gettext_additional_targets=index,literal-block,raw \
doc/source \
doc/source/_build/${LANGUAGE}
# Preview the documentation
firefox doc/source/_build/${LANGUAGE}/index.htmlRelated Dicussions
There was a discussion about translating The NumPy Documentation:
And I believe the numpy-docs-l10n project should be able to surve this purpose.