Announcement
Weโre glad to announce that the
gazebosim-docs-l10n
project is now published:
Preview: gazebosim-docs-l10n
Crowdin: gazebosim-docs-l10n
GitHub: gazebosim-docs-l10n
The goal of this project is to translate The Gazebo 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, please follow the following steps:
- Create an account on Crowdin Enterprise if you donโt have one.
- Log in and go to the gazebosim-docs-l10n project.
- Choose the target language you would like to contribute.
If the target language is not yet supported, please open an issue to request the new language. Once the requested language is added, you can start translating.
How to Reuse Translations?
If the upstream project or anyone wants to reuse the .po files maintained by the this project, they can download the .po files from the po/<version> branch with the following command:
git clone --branch=po/<version> https://github.com/localizethedocs/gazebosim-docs-l10n.git <locale-dir>
Those po/<version> branches are created to facilitate reusage by the upstream project. For instance, the zh_TW documentation for the rotary version can be generated using the demo commands below:
Click to expand the demo commands
BRANCH=master
VERSION=rotary
LANGUAGE=zh_TW
BUILDER=dirhtml
REPODIR=$(pwd)/gazebosim-docs
VENVDIR=$REPODIR/.venv
# Prepare the repository and environment
git clone --branch=$BRANCH --recurse-submodules https://github.com/gazebosim/docs.git $REPODIR
cd $REPODIR
conda create --prefix $VENVDIR --yes
conda activate $VENVDIR
conda install python=3.12 -c conda-forge -c nodefaults --yes
export PYTHONNOUSERSITE=1
python -m ensurepip --default-pip
python -m pip install -r requirements.txt
# Generate source directory
cat << 'EOF' > generate_sources.py
import sys
from pathlib import Path
import yaml
from build_multiversion import generate_sources
def main():
src_dir = Path(".") # points to your project directory
tmp_dir = src_dir / ".tmp"
tmp_dir.mkdir(exist_ok=True)
# read index.yaml
with open(src_dir / "index.yaml") as f:
gz_nav_yaml = yaml.safe_load(f)
# extract command line argument as release
if len(sys.argv) < 2:
print("Usage: python generate_sources.py <release>")
sys.exit(1)
release = sys.argv[1]
generate_sources(gz_nav_yaml, src_dir, tmp_dir, release)
if __name__ == "__main__":
main()
EOF
python generate_sources.py $VERSION
# Clone the .po files to the 'locale' directory
git clone --branch=po/$VERSION https://github.com/localizethedocs/gazebosim-docs-l10n.git .tmp/$VERSION/locale
# Build the documentation
pushd .tmp/$VERSION
sphinx-build \
-b $BUILDER \
-D language=$LANGUAGE \
-D locale_dirs=locale \
-D gettext_compact=0 \
-D gettext_additional_targets=index,literal-block,raw \
-D gz_release=$VERSION \
-D gz_root_index_file=../../index.yaml \
. \
./_build/$LANGUAGE
popd
# Preview the documentation
firefox .tmp/$VERSION/_build/$LANGUAGE/index.html