Skip to content

Commit 0a162fa

Browse files
authored
i18n: disable default smartquotes for zh_CN and zh_TW (#12875)
1 parent 5b8408a commit 0a162fa

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Incompatible changes
1717
Code-blokcs are unchanged as FreeMono is now loaded with ``Scale=0.9``.
1818
An adjustement to existing projects is needed only if they used a custom
1919
:ref:`fontpkg` configuration and did not set :ref:`fvset`.
20+
* #12875: Disable smartquotes for languages: ``zh_CN`` and ``zh_TW`` by default.
2021

2122
Deprecated
2223
----------

sphinx/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class Config:
271271
'smartquotes': _Opt(True, 'env', ()),
272272
'smartquotes_action': _Opt('qDe', 'env', ()),
273273
'smartquotes_excludes': _Opt(
274-
{'languages': ['ja'], 'builders': ['man', 'text']}, 'env', ()),
274+
{'languages': ['ja', 'zh_CN', 'zh_TW'], 'builders': ['man', 'text']}, 'env', ()),
275275
'option_emphasise_placeholders': _Opt(False, 'env', ()),
276276
}
277277

tests/test_markup/test_smartquotes.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,32 @@ def test_ja_html_builder(app):
8686
assert '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' in content
8787

8888

89+
@pytest.mark.sphinx(
90+
'html',
91+
testroot='smartquotes',
92+
freshenv=True,
93+
confoverrides={'language': 'zh_CN'},
94+
)
95+
def test_zh_cn_html_builder(app):
96+
app.build()
97+
98+
content = (app.outdir / 'index.html').read_text(encoding='utf8')
99+
assert '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' in content
100+
101+
102+
@pytest.mark.sphinx(
103+
'html',
104+
testroot='smartquotes',
105+
freshenv=True,
106+
confoverrides={'language': 'zh_TW'},
107+
)
108+
def test_zh_tw_html_builder(app):
109+
app.build()
110+
111+
content = (app.outdir / 'index.html').read_text(encoding='utf8')
112+
assert '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' in content
113+
114+
89115
@pytest.mark.sphinx(
90116
'html',
91117
testroot='smartquotes',

0 commit comments

Comments
 (0)