Skip to content

Commit

Permalink
docs: Add control to toggle language of demo
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Oct 17, 2024
1 parent 0343f15 commit 21fda78
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions demo/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
gettext_compact = False
locale_dirs = ["_locales"]
gettext_last_translator = os.environ.get("SPHINXINTL_TRANSLATOR", None)
# extra
site_basedir = os.environ.get("READTHEDOCS_VERSION", "") + "/"

# -- Options for Revealjs output
revealjs_html_theme = "revealjs-simple"
Expand All @@ -34,6 +36,18 @@
"hash": True,
"center": True,
"transition": "slide",
"customcontrols": {
"controls": [
{
"icon": "EN",
"action": f"location.href = '/{site_basedir}en/';",
},
{
"icon": "JA",
"action": f"location.href = '/{site_basedir}ja/';",
},
]
},
}
revealjs_script_plugins = [
{
Expand All @@ -44,9 +58,14 @@
"name": "RevealMath",
"src": "revealjs/plugin/math/math.js",
},
{
"name": "RevealCustomControls",
"src": "https://cdn.jsdelivr.net/npm/reveal.js-plugins@latest/customcontrols/plugin.js",
},
]
revealjs_css_files = [
"revealjs/plugin/highlight/zenburn.css",
"https://cdn.jsdelivr.net/npm/reveal.js-plugins@latest/customcontrols/style.css",
"custom.css",
]
revealjs_notes_from_comments = True
Expand All @@ -63,6 +82,4 @@
# atsphinx-mini18n
mini18n_default_language = "en"
mini18n_support_languages = ["en", "ja"]
mini18n_basepath = ""
if "READTHEDOCS_VERSION" in os.environ:
mini18n_basepath = f"/{os.environ['READTHEDOCS_VERSION']}/"
mini18n_basepath = f"/{site_basedir}"

0 comments on commit 21fda78

Please sign in to comment.