Skip to content

Commit

Permalink
Merge branch 'demo/mini18n'
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed May 6, 2024
2 parents c6505c9 + d3294b9 commit 17079b4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions demo/_sass/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $green: #859900;
// Override theme settings (see ../template/settings.scss)
$mainColor: $base1;
$headingColor: $base2;
$heading1Size: $heading1Size * 0.8;
$headingTextShadow: none;
$backgroundColor: $base03;
$linkColor: $blue;
Expand Down
35 changes: 35 additions & 0 deletions demo/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# -- General configuration ---------------------------------------------------
extensions = [
"atsphinx.mini18n",
"oembedpy.ext.sphinx",
"sphinx.ext.mathjax",
"sphinx.ext.todo",
Expand Down Expand Up @@ -48,6 +49,18 @@
"hash": True,
"center": True,
"transition": "slide",
"customcontrols": {
"controls": [
{
"icon": "EN",
"action": "location.href = '/en/';",
},
{
"icon": "JA",
"action": "location.href = '/ja/';",
},
]
},
}
revealjs_script_plugins = [
{
Expand All @@ -62,9 +75,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",
]
revealjs_notes_from_comments = True

Expand All @@ -90,11 +108,28 @@
'<meta name="twitter:site" content="@attakei" />',
]

# atsphinx-mini18n
mini18n_default_language = "en"
mini18n_support_languages = ["en", "ja"]


def update_ogp(app, config):
print(config.ogp_site_url, config.language)
config.ogp_site_url = urljoin(config.ogp_site_url, f"{config.language}/")


def _add_navigation_for_mini18n(app, config):
config.revealjs_script_conf["customcontrols"] = {
"controls": [
{
"icon": lang.upper(),
"action": f"location.href = '/{lang}/';",
}
for lang in config.mini18n_support_languages
]
}


def setup(app):
app.connect("config-inited", update_ogp)
app.connect("config-inited", _add_navigation_for_mini18n)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ doc = [
"atsphinx-htmx-boost",
]
demo = [
"atsphinx-mini18n >=0.3.1",
"oEmbedPy",
"sphinx-intl >=2.0.1,<3",
"sphinxcontrib-gtagjs >=0.2.0,<0.3",
Expand Down

0 comments on commit 17079b4

Please sign in to comment.