@@ -71,7 +74,7 @@
{% if parameter.annotation %}
- TYPE:
+ {{ lang.t("TYPE:") }}
{% with expression = parameter.annotation %}
{% include "expression.html" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
index b2b5750..515be81 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
@@ -1,14 +1,17 @@
{{ log.debug("Rendering parameters section") }}
+
+{% import "language.html" as lang with context %}
+
{% if config.docstring_section_style == "table" %}
{% block table_style %}
- {{ section.title or "Parameters:" }}
+ {{ section.title or lang.t("Parameters:") }}
- Name |
- Type |
- Description |
- Default |
+ {{ lang.t("Name") }} |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+ {{ lang.t("Default") }} |
@@ -33,7 +36,7 @@
{% include "expression.html" with context %}
{% endwith %}
{% else %}
- required
+ {{ lang.t("required") }}
{% endif %}
@@ -43,7 +46,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
- {{ section.title or "Parameters:" }}
+ {{ section.title or lang.t("Parameters:") }}
{% for parameter in section.value %}
-
@@ -66,8 +69,8 @@
- {{ (section.title or "PARAMETER").rstrip(":").upper() }} |
- DESCRIPTION |
+ {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
@@ -81,7 +84,7 @@
{% if parameter.annotation %}
- TYPE:
+ {{ lang.t("TYPE:") }}
{% with expression = parameter.annotation %}
{% include "expression.html" with context %}
{% endwith %}
@@ -89,7 +92,7 @@
{% endif %}
{% if parameter.default %}
- DEFAULT:
+ {{ lang.t("DEFAULT:") }}
{% with expression = parameter.default %}
{% include "expression.html" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
index 45832d1..e4edc66 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
@@ -1,12 +1,15 @@
{{ log.debug("Rendering raises section") }}
+
+{% import "language.html" as lang with context %}
+
{% if config.docstring_section_style == "table" %}
{% block table_style %}
- {{ section.title or "Raises:" }}
+ {{ section.title or lang.t("Raises:") }}
- Type |
- Description |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
@@ -31,7 +34,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
- {{ section.title or "Raises:" }}
+ {{ lang.t(section.title) or lang.t("Raises:") }}
{% for raises in section.value %}
-
@@ -53,8 +56,8 @@
- {{ (section.title or "RAISES").rstrip(":").upper() }} |
- DESCRIPTION |
+ {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
index 03b241c..09b8cae 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
@@ -1,14 +1,17 @@
{{ log.debug("Rendering receives section") }}
+
+{% import "language.html" as lang with context %}
+
{% if config.docstring_section_style == "table" %}
{% block table_style %}
{% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or "Receives:" }}
+ {{ section.title or lang.t("Receives:") }}
- {% if name_column %}Name | {% endif %}
- Type |
- Description |
+ {% if name_column %}{{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
@@ -34,7 +37,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
- {{ section.title or "Receives:" }}
+ {{ section.title or lang.t("Receives:") }}
{% for receives in section.value %}
-
@@ -59,8 +62,8 @@
- {{ (section.title or "RECEIVES").rstrip(":").upper() }} |
- DESCRIPTION |
+ {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper()) }} |
+ {{ lang.t("DESCRIPTION") }} |
@@ -84,7 +87,7 @@
{% if receives.name and receives.annotation %}
- TYPE:
+ {{ lang.t("TYPE:") }}
{% with expression = receives.annotation %}
{% include "expression.html" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
index ad63db8..374f8de 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
@@ -1,14 +1,17 @@
{{ log.debug("Rendering returns section") }}
+
+{% import "language.html" as lang with context %}
+
{% if config.docstring_section_style == "table" %}
{% block table_style %}
{% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or "Returns:" }}
+ {{ section.title or lang.t("Returns:") }}
- {% if name_column %}Name | {% endif %}
- Type |
- Description |
+ {% if name_column %}{{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
@@ -34,7 +37,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
- {{ section.title or "Returns:" }}
+ {{ section.title or lang.t("Returns:") }}
{% for returns in section.value %}
-
@@ -59,8 +62,8 @@
- {{ (section.title or "RETURNS").rstrip(":").upper() }} |
- DESCRIPTION |
+ {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION").upper() }} |
@@ -84,7 +87,7 @@
{% if returns.name and returns.annotation %}
- TYPE:
+ {{ lang.t("TYPE:") }}
{% with expression = returns.annotation %}
{% include "expression.html" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
index 49ae438..cf1cc4a 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
@@ -1,12 +1,15 @@
{{ log.debug("Rendering warns section") }}
+
+{% import "language.html" as lang with context %}
+
{% if config.docstring_section_style == "table" %}
{% block table_style %}
- {{ section.title or "Warns:" }}
+ {{ section.title or lang.t("Warns:") }}
- Type |
- Description |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
@@ -31,7 +34,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
- {{ section.title or "Warns:" }}
+ {{ section.title or lang.t("Warns:") }}
{% for warns in section.value %}
-
@@ -53,8 +56,8 @@
- {{ (section.title or "WARNS").rstrip(":").upper() }} |
- DESCRIPTION |
+ {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
index 93b3cfd..9a0db29 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
@@ -1,14 +1,17 @@
{{ log.debug("Rendering yields section") }}
+
+{% import "language.html" as lang with context %}
+
{% if config.docstring_section_style == "table" %}
{% block table_style %}
{% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or "Yields:" }}
+ {{ section.title or lang.t("Yields:") }}
- {% if name_column %}Name | {% endif %}
- Type |
- Description |
+ {% if name_column %}{{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
@@ -34,7 +37,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
- {{ section.title or "Yields:" }}
+ {{ section.title or lang.t("Yields:") }}
{% for yields in section.value %}
-
@@ -59,8 +62,8 @@
- {{ (section.title or "YIELDS").rstrip(":").upper() }} |
- DESCRIPTION |
+ {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
@@ -84,7 +87,7 @@
{% if yields.name and yields.annotation %}
- TYPE:
+ {{ lang.t("TYPE:") }}:
{% with expression = yields.annotation %}
{% include "expression.html" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
index 70c2689..4ae5333 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
@@ -1,5 +1,7 @@
{{ log.debug("Rendering " + function.path) }}
+{% import "language.html" as lang with context %}
+
{% with html_id = function.path %}
@@ -61,7 +63,7 @@
{% if config.show_source and function.source %}
- Source code in {{ function.relative_filepath }}
+ {{ lang.t("Source code in") }} {{ function.relative_filepath }}
{{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html
new file mode 100644
index 0000000..5836ccc
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html
@@ -0,0 +1,28 @@
+
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "ATTRIBUTE",
+ "Attributes:": "Attributes:",
+ "DEFAULT:": "DEFAULT:",
+ "Default": "Default",
+ "DESCRIPTION": "DESCRIPTION",
+ "Description": "Description",
+ "Examples:": "Examples:",
+ "Name": "Name",
+ "Other Parameters:": "Other Parameters:",
+ "PARAMETER": "PARAMETER",
+ "Parameters:": "Parameters:",
+ "RAISES": "RAISES",
+ "Raises:" : "Raises:",
+ "RECEIVES": "RECEIVES",
+ "Receives:": "Receives:",
+ "required": "required",
+ "RETURNS": "RETURNS",
+ "Returns:": "Returns:",
+ "Source code in": "Source code in",
+ "TYPE:": "TYPE:",
+ "Type": "Type",
+ "WARNS": "WARNS",
+ "Warns:": "Warns:",
+ "YIELDS": "YIELDS",
+ "Yields:": "Yields:",
+ }[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html
new file mode 100644
index 0000000..6b52ebc
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html
@@ -0,0 +1,28 @@
+
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes:": "属性:",
+ "DEFAULT:": "デフォルト:",
+ "Default": "デフォルト",
+ "DESCRIPTION": "デスクリプション",
+ "Description": "デスクリプション",
+ "Examples:": "例:",
+ "Name": "名前",
+ "Other Parameters:": "他の引数:",
+ "PARAMETER": "引数",
+ "Parameters:": "引数:",
+ "RAISES": "発生",
+ "Raises:" : "発生:",
+ "RECEIVES": "取得",
+ "Receives:": "取得:",
+ "required": "必須",
+ "RETURNS": "戻り値",
+ "Returns:": "戻り値:",
+ "Source code in": "ソースコード位置:",
+ "TYPE:": "タイプ:",
+ "Type": "タイプ",
+ "WARNS": "警告",
+ "Warns:": "警告:",
+ "YIELDS": "返す",
+ "Yields:": "返す:",
+}[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html
new file mode 100644
index 0000000..a1516f1
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html
@@ -0,0 +1,28 @@
+
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes:": "属性:",
+ "DEFAULT:": "默认:",
+ "Default": "默认",
+ "DESCRIPTION": "描述",
+ "Description": "描述",
+ "Examples:": "示例:",
+ "Name": "名称",
+ "Other Parameters:": "其他参数:",
+ "PARAMETER": "参数",
+ "Parameters:": "参数:",
+ "RAISES": "引发",
+ "Raises:" : "引发:",
+ "Receives:": "接收:",
+ "RECEIVES": "接收",
+ "required": "必需",
+ "RETURNS": "返回",
+ "Returns:": "返回:",
+ "Source code in": "源代码位于:",
+ "TYPE:": "类型:",
+ "Type": "类型",
+ "Warns:": "警告:",
+ "WARNS": "警告",
+ "YIELDS": "产生",
+ "Yields:": "产生:",
+ }[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/language.html b/src/mkdocstrings_handlers/python/templates/material/language.html
new file mode 100644
index 0000000..26647ff
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/language.html
@@ -0,0 +1,10 @@
+
+{% set lang_pth = "languages/" ~ locale ~ ".html" %}
+{% if lang_pth is existing_template %}
+ {% import lang_pth as lang %}
+ {% import "languages/en.html" as fallback %}
+ {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
+{% else %}
+ {% import "languages/en.html" as lang %}
+ {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/en.html b/src/mkdocstrings_handlers/python/templates/material/languages/en.html
new file mode 100644
index 0000000..eab0a3f
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/en.html
@@ -0,0 +1 @@
+{% extends "_base/languages/en.html" %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/ja.html b/src/mkdocstrings_handlers/python/templates/material/languages/ja.html
new file mode 100644
index 0000000..0463322
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/ja.html
@@ -0,0 +1 @@
+{% extends "_base/languages/ja.html" %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/zh.html b/src/mkdocstrings_handlers/python/templates/material/languages/zh.html
new file mode 100644
index 0000000..90aeae6
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/zh.html
@@ -0,0 +1 @@
+{% extends "_base/languages/zh.html" %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
index 3ed566d..6f597cd 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Attributes:" }} |
+ {{ section.title or lang.t("Attributes:") }} |
{% for attribute in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
index c5b4b03..d37bc8c 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Other parameters:" }} |
+ {{ section.title or lang.t("Other parameters:") }} |
{% for parameter in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
index b05733a..461fe2a 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Parameters:" }} |
+ {{ section.title or lang.t("Parameters:") }} |
{% for parameter in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
index b744df2..f82437d 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Raises:" }} |
+ {{ section.title or lang.t("Raises:") }} |
{% for raises in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
index 127bcd3..f112351 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Receives:" }} |
+ {{ section.title or lang.t("Receives:") }} |
{% for receives in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
index 92f29e3..28b8377 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Returns:" }} |
+ {{ section.title or lang.t("Returns:") }} |
{% for returns in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
index 1263178..35aff0b 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Warns:" }} |
+ {{ section.title or lang.t("Warns:") }} |
{% for warns in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
index 86e8ff7..7838a66 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
@@ -1,4 +1,7 @@
{{ log.debug() }}
+
+{% import "language.html" as lang with context %}
+
@@ -6,7 +9,7 @@
- {{ section.title or "Yields:" }} |
+ {{ section.title or lang.t("Yields:") }} |
{% for yields in section.value %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/language.html b/src/mkdocstrings_handlers/python/templates/readthedocs/language.html
new file mode 100644
index 0000000..26647ff
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/language.html
@@ -0,0 +1,10 @@
+
+{% set lang_pth = "languages/" ~ locale ~ ".html" %}
+{% if lang_pth is existing_template %}
+ {% import lang_pth as lang %}
+ {% import "languages/en.html" as fallback %}
+ {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
+{% else %}
+ {% import "languages/en.html" as lang %}
+ {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html
new file mode 100644
index 0000000..acc6d5a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html
@@ -0,0 +1,11 @@
+
+{% macro t(key) %}{{ {
+ "Attributes:": "Attributes:",
+ "Other parameters:": "Other parameters:",
+ "Parameters:": "Parameters:",
+ "Raises:" : "Raises:",
+ "Receives:": "Receives:",
+ "Returns:": "Returns:",
+ "Warns:": "Warns:",
+ "Yields:": "Yields:",
+ }[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html
new file mode 100644
index 0000000..9ae4a56
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html
@@ -0,0 +1,11 @@
+
+{% macro t(key) %}{{ {
+ "Attributes:": "属性:",
+ "Other Parameters:": "他の引数:",
+ "Parameters:": "引数:",
+ "Raises:" : "発生:",
+ "Receives:": "取得:",
+ "Returns:": "戻り値:",
+ "Warns:": "警告:",
+ "Yields:": "返す:",
+ }[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html
new file mode 100644
index 0000000..42184f9
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html
@@ -0,0 +1,11 @@
+
+{% macro t(key) %}{{ {
+ "Attributes:": "属性:",
+ "Other Parameters:": "其他参数:",
+ "Parameters:": "参数:",
+ "Raises:" : "引发:",
+ "Receives:": "接收:",
+ "Returns:": "返回:",
+ "Warns:": "警告:",
+ "Yields:": "产生:",
+ }[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/tests/test_handler.py b/tests/test_handler.py
index fc31942..4971e13 100644
--- a/tests/test_handler.py
+++ b/tests/test_handler.py
@@ -63,7 +63,8 @@ def test_render_docstring_examples_section(handler: PythonHandler) -> None:
],
)
template = handler.env.get_template("docstring/examples.html")
- rendered = template.render(section=section)
+ rendered = template.render(section=section, locale="en")
+ template.render(section=section, locale="not_existing")
assert "This is an example. " in rendered
assert "print" in rendered
assert "Hello" in rendered
| | | | | | | |