Skip to content

Commit

Permalink
i18n: disable default smartquotes for zh_CN and zh_TW (#12875)
Browse files Browse the repository at this point in the history
  • Loading branch information
khanxmetu authored Sep 27, 2024
1 parent 5b8408a commit 0a162fa
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Incompatible changes
Code-blokcs are unchanged as FreeMono is now loaded with ``Scale=0.9``.
An adjustement to existing projects is needed only if they used a custom
:ref:`fontpkg` configuration and did not set :ref:`fvset`.
* #12875: Disable smartquotes for languages: ``zh_CN`` and ``zh_TW`` by default.

Deprecated
----------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class Config:
'smartquotes': _Opt(True, 'env', ()),
'smartquotes_action': _Opt('qDe', 'env', ()),
'smartquotes_excludes': _Opt(
{'languages': ['ja'], 'builders': ['man', 'text']}, 'env', ()),
{'languages': ['ja', 'zh_CN', 'zh_TW'], 'builders': ['man', 'text']}, 'env', ()),
'option_emphasise_placeholders': _Opt(False, 'env', ()),
}

Expand Down
26 changes: 26 additions & 0 deletions tests/test_markup/test_smartquotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ def test_ja_html_builder(app):
assert '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' in content


@pytest.mark.sphinx(
'html',
testroot='smartquotes',
freshenv=True,
confoverrides={'language': 'zh_CN'},
)
def test_zh_cn_html_builder(app):
app.build()

content = (app.outdir / 'index.html').read_text(encoding='utf8')
assert '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' in content


@pytest.mark.sphinx(
'html',
testroot='smartquotes',
freshenv=True,
confoverrides={'language': 'zh_TW'},
)
def test_zh_tw_html_builder(app):
app.build()

content = (app.outdir / 'index.html').read_text(encoding='utf8')
assert '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' in content


@pytest.mark.sphinx(
'html',
testroot='smartquotes',
Expand Down

0 comments on commit 0a162fa

Please sign in to comment.