Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 2, 2025

Overview

This PR adds complete Chinese (Simplified Chinese, zh_CN) localization support for all admonition types in sphinx-proof. Previously, admonition titles were hardcoded in English, and some admonition types were missing Chinese translations.

Problem

When using language = "zh_CN" in Sphinx configuration, admonition titles were displaying in English instead of Chinese:

Before - English titles

Solution

This PR completes the Chinese localization by:

  1. Adding missing Chinese translations for admonition types that had incomplete support:

    • Corollary → 推论
    • Example → 例
    • Proof → 证明 (new translation file created)
  2. Updating the Proof directive to use the translation system by wrapping the title with the _() function

  3. Regenerating locale files (.po and .mo) for zh_CN with all translations

  4. Updating documentation to reflect complete Chinese support

Result

All admonition titles now display correctly in Chinese when language = "zh_CN" is configured:

After - Chinese titles

Complete Chinese Translation Support

English Chinese (zh_CN)
Definition 定义
Theorem 定理
Assumption 假设
Proof 证明
Algorithm 算法
Axiom 公理
Conjecture 猜想
Corollary 推论
Criterion 准则
Example
Lemma 引理
Observation 观察
Property 性质
Proposition 命题
Remark 注记

Usage

To enable Chinese localization in your Sphinx project, simply add this to your conf.py:

language = "zh_CN"

Testing

  • All existing tests pass (15/15)
  • Manually verified Chinese translations display correctly in HTML output
  • Tested with multiple admonition types (Theorem, Definition, Assumption, Proof, Example, Corollary)

Changes

  • sphinx_proof/directive.py - Added translation support to ProofDirective
  • sphinx_proof/translations/jsons/Corollary.json - Added Chinese translation
  • sphinx_proof/translations/jsons/Example.json - Added Chinese translation
  • sphinx_proof/translations/jsons/Proof.json - Created new translation file
  • sphinx_proof/translations/locales/zh_CN/LC_MESSAGES/proof.mo - Regenerated binary locale file
  • docs/source/internationalization.md - Updated documentation

Fixes #145

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Chinese localisation for tiles of admonitions.</issue_title>
<issue_description>### Context

Currently admonitions are written automatically in English.

Image

Proposal

We should update the extension to allow for Chinese titles (and other languages).

Image

In this case Theorem should be 定理

English Chinese
Definition 定义
Theorem 定理
Assumption 假设
Proof 证明

Tasks and updates

  • enable localisation support in extension
  • add Chinese for all admonition types.
  • enable configuration setting for zh-cn</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #152

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 2, 2025 02:05
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Add Chinese localisation for tiles of admonitions. Add complete Chinese (zh_CN) localization for all admonition types Oct 2, 2025
@Copilot Copilot AI requested a review from mmcky October 2, 2025 02:14
Copilot finished work on behalf of mmcky October 2, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Chinese localisation for tiles of admonitions.

2 participants