As part of our mission to democratize machine learning, we aim to make the Transformers library available in many more languages! Follow the steps below to help translate the documentation into your language.
- Navigate to the Issues page of this repository.
- Check if anyone has already opened an issue for your language.
- If not, create a new issue by selecting the "Translation template" from the "New issue" button.
- Post a comment indicating which chapters you’d like to work on, and we’ll add your name to the list.
-
First, fork the Transformers repo by clicking the Fork button in the top-right corner.
-
Clone your fork to your local machine for editing with the following command:
git clone https://github.com/YOUR-USERNAME/transformers.git
Replace
YOUR-USERNAME
with your GitHub username.
The documentation files are organized in the following directory:
- docs/source: This contains all documentation materials organized by language.
To copy the English version to your new language directory:
-
Navigate to your fork of the repository:
cd ~/path/to/transformers/docs
Replace
~/path/to
with your actual path. -
Run the following command:
cp -r source/en source/LANG-ID
Replace
LANG-ID
with the appropriate ISO 639-1 or ISO 639-2 language code (see this table for reference).
Begin translating the text!
-
Start with the
_toctree.yml
file that corresponds to your documentation chapter. This file is essential for rendering the table of contents on the website.- If the
_toctree.yml
file doesn’t exist for your language, create one by copying the English version and removing unrelated sections. - Ensure it is placed in the
docs/source/LANG-ID/
directory.
Here’s an example structure for the
_toctree.yml
file:- sections: - local: pipeline_tutorial # Keep this name for your .md file title: Pipelines for Inference # Translate this ... title: Tutorials # Translate this
- If the
-
Once you’ve translated the
_toctree.yml
, move on to translating the associated MDX files.
If you'd like assistance with your translation, open an issue and tag @stevhliu
. Feel free to share resources or glossaries to ensure consistent terminology.