Skip to content

docs: add atsphinx-mini18n to build i18n site #3966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
15 changes: 14 additions & 1 deletion .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -291,4 +304,4 @@ jobs:
LOG_NAMES: logs-build-docs
shell: bash
run: |
.ci/display_logs_remote.sh
.ci/display_logs_remote.sh
13 changes: 12 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -108,6 +109,7 @@
"sphinx.ext.graphviz",
"ansys_sphinx_theme.extension.linkcode",
"sphinx.ext.mathjax",
"atsphinx.mini18n",
]

# Intersphinx mapping
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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}",
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created #3967 because I found it inconvenient that this isn’t automatically formatted.

"grpcio==1.70.0",
"imageio-ffmpeg==0.6.0",
"imageio==2.37.0",
Expand Down