diff --git a/_templates/layout.html b/_templates/layout.html new file mode 100644 index 000000000..84503df34 --- /dev/null +++ b/_templates/layout.html @@ -0,0 +1,14 @@ +{% extends "!layout.html" -%} +{% block linktags -%} + {% if godot_inject_language_links -%} + {% for alternate_lang in godot_docs_supported_languages -%} + {# Convert to ISO 639-1 format, e.g. zh_CN -> zh-cn -#} + {% set alternate_lang_href = alternate_lang.lower().replace("_", "-") -%} + + {% endfor -%} + + + + {% endif -%} + {{ super() }} +{% endblock -%} diff --git a/community/contributing/documentation_guidelines.rst b/community/contributing/documentation_guidelines.rst index 781155bca..41ce00070 100644 --- a/community/contributing/documentation_guidelines.rst +++ b/community/contributing/documentation_guidelines.rst @@ -95,8 +95,12 @@ You can help to translate the official Godot documentation on our `Hosted Weblat :alt: Translation state :align: center :target: https://hosted.weblate.org/engage/godot-engine/?utm_source=widget + :width: 287 + :height: 66 -There also is the official `Godot I18N repository `_. where you can see when the data was last synced. +There also is the official +`Godot i18n repository `_ +where you can see when the data was last synchronized. License ------- diff --git a/conf.py b/conf.py index 714d782f4..721d9b33a 100644 --- a/conf.py +++ b/conf.py @@ -38,7 +38,32 @@ version = os.getenv("READTHEDOCS_VERSION", "3.0") # The full version, including alpha/beta/rc tags release = version -language = "en" +# 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") +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" exclude_patterns = ["_build"] @@ -78,6 +103,8 @@ html_theme_options = { # '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 html_context = { "display_github": True, # Integrate GitHub @@ -85,6 +112,12 @@ html_context = { "github_repo": "godot-docs", # Repo name "github_version": "master", # Version "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" @@ -123,6 +156,3 @@ linkcheck_timeout = 10 locale_dirs = ["../sphinx/po/"] gettext_compact = False -# Exclude class reference when marked with tag i18n. -if tags.has("i18n"): - exclude_patterns = ["classes"] diff --git a/robots.txt b/robots.txt index 015c50aad..06d70556d 100644 --- a/robots.txt +++ b/robots.txt @@ -1,7 +1,3 @@ user-agent: * -disallow: /*/3.2 -disallow: /*/3.1 -disallow: /*/3.0 -disallow: /*/2.1 sitemap: https://docs.godotengine.org/sitemap.xml