From d5c477ac39b7394a1d9dc4c264a8fb3bf4d12266 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Oct 2025 01:54:57 +0000 Subject: [PATCH 1/3] Initial plan From 2bab6c113009898a9dc7b5f12fcd3e885abf3365 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Oct 2025 02:05:57 +0000 Subject: [PATCH 2/3] Add Chinese translations for all admonition types Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com> --- sphinx_proof/directive.py | 5 ++++- sphinx_proof/translations/jsons/Corollary.json | 1 + sphinx_proof/translations/jsons/Example.json | 1 + sphinx_proof/translations/jsons/Proof.json | 4 ++++ .../locales/zh_CN/LC_MESSAGES/proof.mo | Bin 685 -> 799 bytes 5 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 sphinx_proof/translations/jsons/Proof.json diff --git a/sphinx_proof/directive.py b/sphinx_proof/directive.py index 9d4595b..e629e86 100644 --- a/sphinx_proof/directive.py +++ b/sphinx_proof/directive.py @@ -14,10 +14,13 @@ from sphinx.util import logging from docutils.parsers.rst import directives from sphinx.util.docutils import SphinxDirective +from sphinx.locale import get_translation from .nodes import unenumerable_node, NODE_TYPES from .nodes import proof_node logger = logging.getLogger(__name__) +MESSAGE_CATALOG_NAME = "proof" +_ = get_translation(MESSAGE_CATALOG_NAME) class ElementDirective(SphinxDirective): @@ -124,7 +127,7 @@ def run(self) -> List[Node]: section = nodes.admonition(classes=classes, ids=[typ]) - self.content[0] = "{}. ".format(typ.title()) + self.content[0] + self.content[0] = "{}. ".format(_(typ.title())) + self.content[0] self.state.nested_parse(self.content, 0, section) node = proof_node() diff --git a/sphinx_proof/translations/jsons/Corollary.json b/sphinx_proof/translations/jsons/Corollary.json index 7cd9494..98c8a95 100644 --- a/sphinx_proof/translations/jsons/Corollary.json +++ b/sphinx_proof/translations/jsons/Corollary.json @@ -1,4 +1,5 @@ [ {"language":"English","symbol":"en","text":"Corollary"}, + {"language":"Chinese","symbol":"zh_CN","text":"推论"}, {"language":"German","symbol":"de","text":"Korollar"} ] diff --git a/sphinx_proof/translations/jsons/Example.json b/sphinx_proof/translations/jsons/Example.json index f4286ce..4c0b931 100644 --- a/sphinx_proof/translations/jsons/Example.json +++ b/sphinx_proof/translations/jsons/Example.json @@ -1,5 +1,6 @@ [ {"language":"English","symbol":"en","text":"Example"}, + {"language":"Chinese","symbol":"zh_CN","text":"例"}, {"language":"Czech","symbol":"cs","text":"Příklad"}, {"language":"Dutch","symbol":"nl","text":"Voorbeeld"}, {"language":"French","symbol":"fr","text":"Exemple"}, diff --git a/sphinx_proof/translations/jsons/Proof.json b/sphinx_proof/translations/jsons/Proof.json new file mode 100644 index 0000000..a0fbec1 --- /dev/null +++ b/sphinx_proof/translations/jsons/Proof.json @@ -0,0 +1,4 @@ +[ + {"language":"English","symbol":"en","text":"Proof"}, + {"language":"Chinese","symbol":"zh_CN","text":"证明"} +] diff --git a/sphinx_proof/translations/locales/zh_CN/LC_MESSAGES/proof.mo b/sphinx_proof/translations/locales/zh_CN/LC_MESSAGES/proof.mo index 7128e187484fa50eede67913eece77ecf69ed6ce..cab6a899a2846e4213109a3188559e7d27e97a2e 100644 GIT binary patch delta 508 zcmXxgze~eV5C`x}Y^&DaE;{Js?C9tq>L%#F5FwR7(nu`Q4iZ$TiVzC1pdw^c2irjq zDpH(u5jVj>y4bYA!9@fS2fr83gUjc=clUTN?;;tb+{SRCOo&0`81e);!ea#=L>_j- z0!+hgn1r6p52PN5=dykYJJDB%+lZfUb9wBofdS< z(r9scO?TF{xU%HfcE;aOz9w7VSyZ{EaHkmV9#L31Zr1jwS>LDdrra(SDLUN>s{uvT L&DNpkm(=lJb3|0c delta 411 zcmbQwwwAU2o)F7a1|Z-CVi_QA0b)TQegniHV8F=0zzL)cfixG8wg%FyK-vw;_kqfX zL-~nN`5Yk44OCYIq&a|e9hBb=q}hP{$v~Q&fuWvZ7Lc(GD6j}B5y=EmkN~CAp>!UU zE``!HP`VjPcR}fiPJNB~{NzylQkxtnaw(&>YEfoMYEfo>9)nA2T4r8m35e;Fnwy)*;Ga~ST2z(@5}ACL@rT9J_O_=T zGZ~()oAqR8C&SY{Q=d<0V|cN=>FN6U49^;tzu2;Z;pxP^FBi>Vc(!@Pi**}7DnUvB DZIDMV From 83834c16f20f07677e69f179be7b9df76d971995 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Oct 2025 02:10:45 +0000 Subject: [PATCH 3/3] Update documentation for complete Chinese localization Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com> --- docs/source/internationalization.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/source/internationalization.md b/docs/source/internationalization.md index 9b48cd8..e1a5317 100644 --- a/docs/source/internationalization.md +++ b/docs/source/internationalization.md @@ -13,6 +13,4 @@ This package supports the following languages specified in `conf.py` using the - ru - zh_CN -```{note} Work in progress -Not all languages listed above are support across all admonition types -``` +All admonition types (Theorem, Definition, Lemma, Proof, Assumption, Corollary, Example, etc.) are fully translated into Chinese (zh_CN).