diff --git a/document.code-workspace b/document.code-workspace index e01256b9..3b13ff77 100644 --- a/document.code-workspace +++ b/document.code-workspace @@ -26,7 +26,7 @@ "options": { "env": { "SPHINXBUILD": "sphinx-autobuild", - "SPHINXOPTS": "-D language='${input:language}'" + "LANGUAGE": "${input:language}" }, "cwd": "${workspaceFolder:document}" }, @@ -41,7 +41,7 @@ ], "options": { "env": { - "SPHINXOPTS": "-D language='${input:language}'" + "LANGUAGE": "${input:language}" }, "cwd": "${workspaceFolder:document}" }, diff --git a/next/README.md b/next/README.md index 0cec7fc6..1384f86d 100644 --- a/next/README.md +++ b/next/README.md @@ -40,7 +40,7 @@ python3 -m http.server -d _build/html For Chinese version: ```bash -make -e SPHINXOPTS="-D language='zh_CN'" html +LANGUAGE="zh_CN" make html python3 -m http.server -d _build/html ``` diff --git a/next/conf.py b/next/conf.py index fcfaa404..376b6c2f 100644 --- a/next/conf.py +++ b/next/conf.py @@ -6,11 +6,21 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -project = 'MoonBit Document' -copyright = '2025, International Digital Economy Academy' +project = 'MoonBit' author = 'International Digital Economy Academy' +copyright = '%Y, {author}'.format(author=author) release = 'v0.1.20250113' +# I18N based on Readthedocs Environment +# https://docs.readthedocs.io/en/stable/reference/environment-variables.html +import os +if (os.getenv('READTHEDOCS_LANGUAGE') == 'zh-cn' or + os.getenv('LANGUAGE') == 'zh_CN'): # For local build + project = 'MoonBit 月兔' + author = '粤港澳大湾区数字经济院' + copyright = '%Y, {author}'.format(author=author) + language = 'zh_CN' + # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -39,7 +49,7 @@ "use_edit_page_button": True, "use_issues_button": True, "logo": { - "text":"MoonBit Documentation", + "text":"MoonBit 月兔", } } html_logo = "_static/logo.png"