diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 7d8973c365..10a1daeb53 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -228,6 +228,19 @@ jobs: run: | xvfb-run make -C doc ${{ inputs.builder }} SPHINXOPTS="-j auto -W --keep-going" + - uses: actions/checkout@v4 + with: + repository: tkoyama010/pymapdl-doc-translations + path: pymapdl-doc-translations + fetch-depth: 0 + persist-credentials: false + + - name: Build I18N Documentation + run: | + xvfb-run make -C doc mini18n-html SPHINXOPTS="-j auto -W --keep-going" + find doc/_build/mini18n-html -mindepth 1 -maxdepth 1 -type d -exec cp -rf {} doc/_build/html/ \; + rm -rf doc/_build/mini18n-html + - name: "Substitute defective GIF" shell: bash run: | @@ -291,4 +304,4 @@ jobs: LOG_NAMES: logs-build-docs shell: bash run: | - .ci/display_logs_remote.sh \ No newline at end of file + .ci/display_logs_remote.sh diff --git a/doc/source/conf.py b/doc/source/conf.py index e14000634e..7528df2405 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -8,6 +8,7 @@ import ansys.tools.visualization_interface as viz_interface from ansys_sphinx_theme import ansys_favicon, get_version_match +from atsphinx.mini18n import get_template_dir import numpy as np import plotly.io as pio from plotly.io._sg_scraper import plotly_sg_scraper @@ -108,6 +109,7 @@ "sphinx.ext.graphviz", "ansys_sphinx_theme.extension.linkcode", "sphinx.ext.mathjax", + "atsphinx.mini18n", ] # Intersphinx mapping @@ -175,7 +177,7 @@ panels_add_fontawesome_latex = True # Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] +templates_path = ["_templates", get_template_dir()] # The suffix(es) of source filenames. source_suffix = ".rst" @@ -298,6 +300,10 @@ html_short_title = html_title = "PyMAPDL" html_theme = "ansys_sphinx_theme" html_theme_options = { + "navbar_start": [ + "navbar-logo", + "mini18n/snippets/select-lang", + ], "logo": "pyansys", "analytics": {"google_analytics_id": "G-JQJKPV6ZVB"}, "github_url": f"https://github.com/{USERNAME}/{REPOSITORY_NAME}", @@ -440,6 +446,11 @@ # A list of files that should not be packed into the epub file. epub_exclude_files = ["search.html"] +# -- atsphinx.mini18n options ------------------------------------------------- +mini18n_default_language = language +mini18n_support_languages = ["en", "ja"] +locale_dirs = ["../../pymapdl-doc-translations/locale"] + def setup(app: Sphinx): """Add custom configuration to sphinx app. diff --git a/pyproject.toml b/pyproject.toml index df32615b30..d7a0a4a170 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,6 +87,7 @@ doc = [ "ansys-mapdl-reader==0.55.1", "ansys-sphinx-theme==1.5.0", "ansys-tools-visualization-interface==0.9.1", + "atsphinx-mini18n==0.4.1", "grpcio==1.70.0", "imageio-ffmpeg==0.6.0", "imageio==2.37.0",