Skip to content

Commit

Permalink
feat: User can edit label of selectbox on snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Mar 24, 2024
1 parent e5ecdce commit f4b464d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
28 changes: 22 additions & 6 deletions doc/_locales/ja/LC_MESSAGES/usage/configuration.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 02:42+0900\n"
"POT-Creation-Date: 2024-03-25 03:33+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Kazuya Takei <[email protected]>\n"
"Language: ja\n"
Expand Down Expand Up @@ -37,6 +37,7 @@ msgid "Type"
msgstr ""

#: ../../usage/configuration.rst:12 ../../usage/configuration.rst:33
#: ../../usage/configuration.rst:44
msgid "``str``"
msgstr ""

Expand Down Expand Up @@ -95,22 +96,37 @@ msgstr ""
msgid ""
"This is used to build navigate URL on root document. You edit it if "
"document is deployed on sub-directory of domains."
msgstr "この値はドキュメントルートにアクセスした際のリダイレクト先の判定に用いられます。"
"デプロイ先がドメインのサブディレクトリの場合に編集してください。"
msgstr "この値はドキュメントルートにアクセスした際のリダイレクト先の判定に用いられます。デプロイ先がドメインのサブディレクトリの場合に編集してください。"

#: ../../usage/configuration.rst:40
msgid "Value must be end with slash."
msgstr "設定値はスラッシュで終わる必要があります。"

#: ../../usage/configuration.rst:43
#: ../../usage/configuration.rst:45
msgid "``\"Language:\"``"
msgstr ""

#: ../../usage/configuration.rst
msgid "Example"
msgstr ""

#: ../../usage/configuration.rst:46
msgid "``\"Lang:\"``"
msgstr ""

#: ../../usage/configuration.rst:48
msgid "This is used as label text for language select-box on snippet."
msgstr "この値は、埋め込み用スニペットにある言語選択ボックスのラベル要素になります。"

#: ../../usage/configuration.rst:51
msgid "Snippets"
msgstr ""

#: ../../usage/configuration.rst:45
#: ../../usage/configuration.rst:53
msgid "You can emmbed snippets in document to navigate easily."
msgstr "言語間の遷移を用意にするために、提供されているスニペットを埋め込むことが出来ます。"

#: ../../usage/configuration.rst:48
#: ../../usage/configuration.rst:56
msgid "Example: set into document used \"Furo\" theme"
msgstr "例: \"Furo\"テーマに使用するコード"

8 changes: 8 additions & 0 deletions doc/usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ There are some options to customize behavior.

.. note:: Value must be end with slash.

.. confval:: mini18n_select_lang_label

:Type: ``str``
:Default: ``"Language:"``
:Example: ``"Lang:"``

This is used as label text for language select-box on snippet.

Snippets
========

Expand Down
2 changes: 2 additions & 0 deletions src/atsphinx/mini18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def autocomplete_config(app: Sphinx, config: Config):
config.html_context["mini18n"] = {
"basepath": config.mini18n_basepath,
"support_languages": config.mini18n_support_languages,
"select_lang_label": config.mini18n_select_lang_label,
}


Expand All @@ -112,6 +113,7 @@ def setup(app: Sphinx): # noqa: D103
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.add_config_value("mini18n_select_lang_label", "Language:", "env")
app.connect("config-inited", autocomplete_config)
return {
"version": __version__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
</style>
<div>
<label for="atsphinx-mini18n-select-lang">Language</label>
<label for="atsphinx-mini18n-select-lang">{{ mini18n.select_lang_label }}</label>
<select name="lang" onchange="location.href=value;" id="atsphinx-mini18n-select-lang">
{%- for code in mini18n.support_languages %}
<option value="{{ pathto('../' + code + '/', 1) }}{{ pathto(pagename, 0, '.') }}" {%- if code==language %}
Expand Down

0 comments on commit f4b464d

Please sign in to comment.