Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translatable strings using %r and %s cause problems if translation reverses order #6821

Closed
jfbu opened this issue Nov 14, 2019 · 1 comment
Closed

Comments

@jfbu
Copy link
Contributor

jfbu commented Nov 14, 2019

On master branch (at circa 14-11-2019 16:42:29 CET for transifex pull)

cd sphinx/locale
tx pull -f -a
cd ../..
python setup.py compile_catalog

output (trimmed)

running compile_catalog
...
error: sphinx/locale/ja/LC_MESSAGES/sphinx.po:1280: positional format placeholders are unbalanced
error: sphinx/locale/ja/LC_MESSAGES/sphinx.po:2415: incompatible format for placeholder 1: 'r' and 's' are not compatible
...
error: sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po:403: incompatible format for placeholder 1: 'r' and 's' are not compatible
compiling catalog sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po to sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo
...
Compiling failed.

Apart from the problem at sphinx/locale/ja/LC_MESSAGES/sphinx.po:1280 (there were others earlier so I think transifex has been updated recently) the problem is with strings such as

#: sphinx/ext/coverage.py:46
#, python-format
msgid "invalid regex %r in %s"
msgstr "%s 内に無効な正規表現 %r があります"

where translation permutes order. For Chinese:

#: sphinx/registry.py:464
#, python-format
msgid ""
"the extension %r was already merged with Sphinx since version %s; this "
"extension is ignored."
msgstr "自版本 %s 开始,扩展 %r 已合并至 Sphinx;该扩展被忽略。"

When more translation work will be done at transifex more and more such occurrences will arise for languages where order is permuted with respect to English.

It seems usage of .fmt should solve this.

edit: I of course meant "usage of .format() would solve this"

@tk0miya
Copy link
Member

tk0miya commented Nov 14, 2019

I fixed Japanese translations in #6823. But error in Chinese translations still remains. So I keep this opened.

@tk0miya tk0miya added this to the 2.2.2 milestone Nov 14, 2019
tk0miya added a commit that referenced this issue Dec 2, 2019
Fix #6821: i18n: some translation messages has been broken
@tk0miya tk0miya closed this as completed Dec 2, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants