From b8f28cdbd663b902264279090dda0357f68ef8e7 Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 18 Oct 2024 03:27:29 +0900 Subject: [PATCH 1/6] docs: Demo use mini18n --- demo-ja/conf.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/demo-ja/conf.py b/demo-ja/conf.py index bff0f15..9751780 100644 --- a/demo-ja/conf.py +++ b/demo-ja/conf.py @@ -1,5 +1,7 @@ """Config of demo.""" +import os + from atsphinx.revealjs_rtd import __version__ project = "atsphinx-revealjs-rtd" @@ -10,6 +12,7 @@ # -- General configuration extensions = [ "rst_budoux.sphinx", + "atsphinx.mini18n", "atsphinx.revealjs_rtd", ] templates_path = ["_templates"] @@ -51,3 +54,9 @@ overflow-wrap: anywhere; } """ +# 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']}/" From 32fbe4fcbecc26fa06e418e5008e8f705ee39d99 Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 18 Oct 2024 03:28:53 +0900 Subject: [PATCH 2/6] docs: Migration demo folder --- Taskfile.yaml | 2 +- {demo-ja => demo}/.gitignore | 0 {demo-ja => demo}/Taskfile.yaml | 0 {demo-ja => demo}/conf.py | 0 {demo-ja => demo}/index.rst | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename {demo-ja => demo}/.gitignore (100%) rename {demo-ja => demo}/Taskfile.yaml (100%) rename {demo-ja => demo}/conf.py (100%) rename {demo-ja => demo}/index.rst (100%) diff --git a/Taskfile.yaml b/Taskfile.yaml index dbede21..30e73d9 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -2,7 +2,7 @@ version: '3' includes: docs: './docs' - demo-ja: './demo-ja' + demo: './demo' vars: # If you run bare environment or activated venv, set '' (blank string) diff --git a/demo-ja/.gitignore b/demo/.gitignore similarity index 100% rename from demo-ja/.gitignore rename to demo/.gitignore diff --git a/demo-ja/Taskfile.yaml b/demo/Taskfile.yaml similarity index 100% rename from demo-ja/Taskfile.yaml rename to demo/Taskfile.yaml diff --git a/demo-ja/conf.py b/demo/conf.py similarity index 100% rename from demo-ja/conf.py rename to demo/conf.py diff --git a/demo-ja/index.rst b/demo/index.rst similarity index 100% rename from demo-ja/index.rst rename to demo/index.rst From be837bb5d87745839362debe8d3f98105874aaae Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 18 Oct 2024 03:30:34 +0900 Subject: [PATCH 3/6] docs: Settings for i18n of demo --- demo/Taskfile.yaml | 2 +- demo/conf.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/demo/Taskfile.yaml b/demo/Taskfile.yaml index d193c56..58ac502 100644 --- a/demo/Taskfile.yaml +++ b/demo/Taskfile.yaml @@ -3,7 +3,7 @@ version: '3' vars: # If you run bare environment or activated venv, set '' (blank string) # RUN_PYTHON: '' - SPHINX_DEFAULT_BUILD: 'mini18n-dirhtml' + SPHINX_DEFAULT_BUILD: 'mini18n-dirrevealjs' SPHINX_OPTIONS: '' SPHINX_LANGUAGES: - 'ja' diff --git a/demo/conf.py b/demo/conf.py index 9751780..1b35316 100644 --- a/demo/conf.py +++ b/demo/conf.py @@ -17,7 +17,12 @@ ] templates_path = ["_templates"] exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] -language = "ja" +language = "en" + +# -- Options for i18n +gettext_compact = False +locale_dirs = ["_locales"] +gettext_last_translator = os.environ.get("SPHINXINTL_TRANSLATOR", None) # -- Options for Revealjs output revealjs_html_theme = "revealjs-simple" From 3f7f8b58669857f4dc841fa0a43ba1bb0162682f Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 18 Oct 2024 03:35:04 +0900 Subject: [PATCH 4/6] docs: Back translate ja to en (changed default language) --- demo/_locales/ja/LC_MESSAGES/index.po | 48 +++++++++++++++++++++++++++ demo/index.rst | 14 ++++---- 2 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 demo/_locales/ja/LC_MESSAGES/index.po diff --git a/demo/_locales/ja/LC_MESSAGES/index.po b/demo/_locales/ja/LC_MESSAGES/index.po new file mode 100644 index 0000000..461dee6 --- /dev/null +++ b/demo/_locales/ja/LC_MESSAGES/index.po @@ -0,0 +1,48 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2024, Kazuya Takei +# This file is distributed under the same license as the +# atsphinx-revealjs-rtd package. +# FIRST AUTHOR , 2024. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: atsphinx-revealjs-rtd \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-18 03:32+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Kazuya Takei \n" +"Language: ja\n" +"Language-Team: ja \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" + +#: ../../index.rst:3 +msgid "atsphinx-revealjs-rtd" +msgstr "" + +#: ../../index.rst:5 +msgid "sphinx-revealjs presentation managed on Read the Docs." +msgstr "Read the Docs 上で管理する sphinx-revealjs製プレゼンテーション" + +#: ../../index.rst:8 +msgid "Features" +msgstr "機能" + +#: ../../index.rst:11 +msgid "Toggle widget to switch version of document" +msgstr "バージョン切り替えウィジェットの表示切り替え" + +#: ../../index.rst:13 +msgid "" +"When you press ``D`` key, widget is toggled display put on bottom-right " +"of page." +msgstr "" +"``D`` を押すごとに、スライド右下に表示されているRead the Docsから生成されたウィジェットの表示を切り替えます。" + +#: ../../index.rst:15 +msgid "you can hide it to read presentation with concentrately" +msgstr "プレゼンに集中したいときに、非表示にすることが出来ます。" diff --git a/demo/index.rst b/demo/index.rst index 4dd182f..95ea5f5 100644 --- a/demo/index.rst +++ b/demo/index.rst @@ -2,14 +2,14 @@ atsphinx-revealjs-rtd ===================== -Read the Docs 上で管理するsphinx-revealjs製プレゼンテーション +sphinx-revealjs presentation managed on Read the Docs. -機能 -==== +Features +======== -バージョン切り替えウィジェットの表示切り替え --------------------------------------------- +Toggle widget to switch version of document +------------------------------------------- -``D`` を押すごとに、スライド右下に表示されているRead the Docsから生成されたウィジェットの表示を切り替えます。 +When you press ``D`` key, widget is toggled display put on bottom-right of page. -プレゼンに集中したいときに、非表示にすることが出来ます。 +you can hide it to read presentation with concentrately From f45326aec659e558f93def6acef087324bf06149 Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 18 Oct 2024 03:39:45 +0900 Subject: [PATCH 5/6] docs: Customize for render --- demo/_static/custom.css | 3 +++ demo/conf.py | 1 + 2 files changed, 4 insertions(+) create mode 100644 demo/_static/custom.css diff --git a/demo/_static/custom.css b/demo/_static/custom.css new file mode 100644 index 0000000..5ec71d9 --- /dev/null +++ b/demo/_static/custom.css @@ -0,0 +1,3 @@ +body * { + text-transform: none !important; +} diff --git a/demo/conf.py b/demo/conf.py index 1b35316..2cc7ac1 100644 --- a/demo/conf.py +++ b/demo/conf.py @@ -47,6 +47,7 @@ ] revealjs_css_files = [ "revealjs/plugin/highlight/zenburn.css", + "custom.css", ] revealjs_notes_from_comments = True From c22c7c01f27fd7d8c8f28d1be7cf9383a1577d1e Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 18 Oct 2024 03:40:27 +0900 Subject: [PATCH 6/6] docs: Fix RTH workflow --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 018a6d9..786df3f 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,7 +7,7 @@ build: commands: - pip install uv - uv sync --frozen - - uv run sphinx-build -b revealjs demo-ja $READTHEDOCS_OUTPUT/html + - uv run sphinx-build -b mini18n-revealjs demo $READTHEDOCS_OUTPUT/html # Build documentation in the doc/ directory with Sphinx # sphinx: