feat: refactoring for sphinx localisation support

This commit is contained in:
Ana Custura 2024-12-05 15:58:11 +00:00 committed by irl
parent 368b4ba0c1
commit bf5e7c383a
6 changed files with 189 additions and 33 deletions

View file

@ -1,17 +1,36 @@
import builtins
import os
import sys
import yaml
sys.path.insert(0, os.path.abspath('..'))
language = 'en' # default language
locale_dirs = ['./locale/']
gettext_compact = False
templates_path = ['./_templates']
builtins.__sphinx_build__ = True
# Define languages and links in html_context
# this is used with templates in /_templates to extend the default theme,
# adding languages to the sidebar
with open('languages.yaml', 'r') as file:
config = yaml.safe_load(file)
languages = config.get('languages', [])
html_context = {
'languages': [[lang['code'], lang['name']] for lang in languages]
}
# -- Project information -----------------------------------------------------
project = 'Bypass Censorship Portal'
copyright = '2021-202r SR2 Communications Limited'
author = 'Bypass Censorship'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
@ -31,7 +50,6 @@ templates_path = ['_templates']
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for