diff --git a/doc/_locales/ja/LC_MESSAGES/usage/configuration.po b/doc/_locales/ja/LC_MESSAGES/usage/configuration.po index 2b496fc..e96d470 100644 --- a/doc/_locales/ja/LC_MESSAGES/usage/configuration.po +++ b/doc/_locales/ja/LC_MESSAGES/usage/configuration.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: atsphinx-mini18n 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-24 01:43+0900\n" +"POT-Creation-Date: 2024-03-24 02:42+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Kazuya Takei \n" "Language: ja\n" @@ -36,7 +36,7 @@ msgstr "拡張の動作をカスタマイズするための設定項目が存在 msgid "Type" msgstr "" -#: ../../usage/configuration.rst:12 +#: ../../usage/configuration.rst:12 ../../usage/configuration.rst:33 msgid "``str``" msgstr "" @@ -83,15 +83,34 @@ msgstr "i18n機能を用いてビルドする対象の言語リスト。言語 msgid "If this is ``None`` , complete to [:confval:`mini18n_default_language`]." msgstr "この値が ``None`` の場合は、 [:confval:`mini18n_default_language`]とみなします。" -#: ../../usage/configuration.rst:32 +#: ../../usage/configuration.rst:34 +msgid "``/``" +msgstr "" + +#: ../../usage/configuration.rst:35 +msgid "``\"/mini18n/\"``" +msgstr "" + +#: ../../usage/configuration.rst:37 +msgid "" +"This is used to build navigate URL on root document. You edit it if " +"document is deployed on sub-directory of domains." +msgstr "この値はドキュメントルートにアクセスした際のリダイレクト先の判定に用いられます。" +"デプロイ先がドメインのサブディレクトリの場合に編集してください。" + +#: ../../usage/configuration.rst:40 +msgid "Value must be end with slash." +msgstr "設定値はスラッシュで終わる必要があります。" + +#: ../../usage/configuration.rst:43 msgid "Snippets" msgstr "" -#: ../../usage/configuration.rst:34 +#: ../../usage/configuration.rst:45 msgid "You can emmbed snippets in document to navigate easily." msgstr "言語間の遷移を用意にするために、提供されているスニペットを埋め込むことが出来ます。" -#: ../../usage/configuration.rst:37 +#: ../../usage/configuration.rst:48 msgid "Example: set into document used \"Furo\" theme" msgstr "例: \"Furo\"テーマに使用するコード" diff --git a/doc/conf.py b/doc/conf.py index a545567..19c802a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -49,6 +49,7 @@ # atsphinx.mini18n mini18n_default_language = "ja" mini18n_support_languages = ["en", "ja"] +mini18n_basepath = "/mini18n/" def setup(app): diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 4850c49..43dc717 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -28,6 +28,17 @@ There are some options to customize behavior. If this is ``None`` , complete to [:confval:`mini18n_default_language`]. +.. confval:: mini18n_basepath + + :Type: ``str`` + :Default: ``/`` + :Exaple: ``"/mini18n/"`` + + This is used to build navigate URL on root document. + You edit it if document is deployed on sub-directory of domains. + + .. note:: Value must be end with slash. + Snippets ======== diff --git a/src/atsphinx/mini18n/__init__.py b/src/atsphinx/mini18n/__init__.py index 3f218f5..9820471 100644 --- a/src/atsphinx/mini18n/__init__.py +++ b/src/atsphinx/mini18n/__init__.py @@ -89,6 +89,7 @@ def autocomplete_config(app: Sphinx, config: Config): if not config.html_context: config.html_context = {} config.html_context["mini18n"] = { + "basepath": config.mini18n_basepath, "support_languages": config.mini18n_support_languages, } @@ -101,6 +102,7 @@ def setup(app: Sphinx): # noqa: D103 register_i18n_builders(app) app.add_config_value("mini18n_default_language", None, "env") app.add_config_value("mini18n_support_languages", [], "env") + app.add_config_value("mini18n_basepath", "/", "env") app.connect("config-inited", autocomplete_config) return { "version": __version__, diff --git a/src/atsphinx/mini18n/templates/mini18n/index.html b/src/atsphinx/mini18n/templates/mini18n/index.html index 558b4bd..98a269b 100644 --- a/src/atsphinx/mini18n/templates/mini18n/index.html +++ b/src/atsphinx/mini18n/templates/mini18n/index.html @@ -10,9 +10,12 @@