|
@@ -46,8 +46,33 @@ if env_tags != None:
|
|
tags.add(tag.strip())
|
|
tags.add(tag.strip())
|
|
|
|
|
|
# Language / i18n
|
|
# Language / i18n
|
|
|
|
+
|
|
|
|
+supported_languages = {
|
|
|
|
+ "en": "Godot Engine (%s) documentation in English",
|
|
|
|
+ "de": "Godot Engine (%s) Dokumentation auf Deutsch",
|
|
|
|
+ "es": "Documentación de Godot Engine (%s) en español",
|
|
|
|
+ "fr": "Documentation de Godot Engine (%s) en français",
|
|
|
|
+ "fi": "Godot Engine (%s) dokumentaatio suomeksi",
|
|
|
|
+ "it": "Godot Engine (%s) documentazione in italiano",
|
|
|
|
+ "ja": "Godot Engine (%s)の日本語のドキュメント",
|
|
|
|
+ "ko": "Godot Engine (%s) 문서 (한국어)",
|
|
|
|
+ "pl": "Dokumentacja Godot Engine (%s) w języku polskim",
|
|
|
|
+ "pt_BR": "Documentação da Godot Engine (%s) em Português Brasileiro",
|
|
|
|
+ "ru": "Документация Godot Engine (%s) на русском языке",
|
|
|
|
+ "uk": "Документація до Godot Engine (%s) українською мовою",
|
|
|
|
+ "zh_CN": "Godot Engine (%s) 简体中文文档",
|
|
|
|
+}
|
|
|
|
+
|
|
language = os.getenv("READTHEDOCS_LANGUAGE", "en")
|
|
language = os.getenv("READTHEDOCS_LANGUAGE", "en")
|
|
-is_i18n = tags.has("i18n")
|
|
|
|
|
|
+if not language in supported_languages.keys():
|
|
|
|
+ print("Unknown language: " + language)
|
|
|
|
+ print("Supported languages: " + ", ".join(supported_languages.keys()))
|
|
|
|
+ print(
|
|
|
|
+ "The configured language is either wrong, or it should be added to supported_languages in conf.py. Falling back to 'en'."
|
|
|
|
+ )
|
|
|
|
+ language = "en"
|
|
|
|
+
|
|
|
|
+is_i18n = tags.has("i18n") # noqa: F821
|
|
|
|
|
|
exclude_patterns = ["_build"]
|
|
exclude_patterns = ["_build"]
|
|
|
|
|
|
@@ -88,6 +113,8 @@ html_theme_options = {
|
|
# 'navigation_depth': 4, # Depth of the headers shown in the navigation bar
|
|
# 'navigation_depth': 4, # Depth of the headers shown in the navigation bar
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+html_title = supported_languages[language] % version
|
|
|
|
+
|
|
# VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
|
|
# VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
|
|
html_context = {
|
|
html_context = {
|
|
"display_github": not is_i18n, # Integrate GitHub
|
|
"display_github": not is_i18n, # Integrate GitHub
|
|
@@ -95,6 +122,12 @@ html_context = {
|
|
"github_repo": "godot-docs", # Repo name
|
|
"github_repo": "godot-docs", # Repo name
|
|
"github_version": "master", # Version
|
|
"github_version": "master", # Version
|
|
"conf_py_path": "/", # Path in the checkout to the docs root
|
|
"conf_py_path": "/", # Path in the checkout to the docs root
|
|
|
|
+ "godot_inject_language_links": True,
|
|
|
|
+ "godot_docs_supported_languages": list(supported_languages.keys()),
|
|
|
|
+ "godot_docs_basepath": "https://docs.godotengine.org/",
|
|
|
|
+ "godot_docs_suffix": ".html",
|
|
|
|
+ "godot_default_lang": "en",
|
|
|
|
+ "godot_canonical_version": "stable",
|
|
}
|
|
}
|
|
|
|
|
|
html_logo = "img/docs_logo.png"
|
|
html_logo = "img/docs_logo.png"
|
|
@@ -142,6 +175,8 @@ rst_epilog = """
|
|
.. |weblate_widget| image:: https://hosted.weblate.org/widgets/godot-engine/{image_locale}/godot-docs/287x66-white.png
|
|
.. |weblate_widget| image:: https://hosted.weblate.org/widgets/godot-engine/{image_locale}/godot-docs/287x66-white.png
|
|
:alt: Translation status
|
|
:alt: Translation status
|
|
:target: https://hosted.weblate.org/engage/godot-engine{target_locale}/?utm_source=widget
|
|
:target: https://hosted.weblate.org/engage/godot-engine{target_locale}/?utm_source=widget
|
|
|
|
+ :width: 287
|
|
|
|
+ :height: 66
|
|
""".format(
|
|
""".format(
|
|
image_locale="-" if language == "en" else language,
|
|
image_locale="-" if language == "en" else language,
|
|
target_locale="" if language == "en" else "/" + language,
|
|
target_locale="" if language == "en" else "/" + language,
|