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

Safe formatting of translatable strings #8954

Merged
merged 4 commits into from
Mar 4, 2021

Conversation

askhl
Copy link
Contributor

@askhl askhl commented Mar 3, 2021

Subject: Safe formatting of translatable strings

Feature or Bugfix

  • Bugfix

Purpose

There are 100+ languages, which is enough for Murphy's law to take effect if anything is imperfect.

The error recently fixed for Spanish (#8943) similarly exists in Hungarian and Greek.

Rather than fixing them individually (and have them come back in new translations), this fix changes the strings so the error cannot occur again. This of course invalidates the translations. Let me know if I should attempt to adapt the translations as well, but state of the art i18n wisdom is that it's best left to translators.

(I specify 3.5.x as target branch, but if merged, this should probably be merged/cherrypicked to master etc. as well.)

Detail

Current faulty translations:

askhl@erlkoenig:~/src/sphinx/sphinx/locale$ gtgrep --msgid '%%\(target\)' */*/*.po  --imsgstr '%%\(target\)' --msgstr . -n
el/LC_MESSAGES/sphinx.po:3303
#: sphinx/transforms/post_transforms/__init__.py:171
#, python-format
msgid "%s:%s reference target not found: %%(target)s"
msgstr "Ο %s:%s στόχος αναφοράς δεν βρέθηκε: %% (στόχος)"

el/LC_MESSAGES/sphinx.po:3308
#: sphinx/transforms/post_transforms/__init__.py:174
#, python-format
msgid "%r reference target not found: %%(target)s"
msgstr "ο στόχος αναφοράς %r δεν βρέθηκε: %%(στόχος)"

hr/LC_MESSAGES/sphinx.po:3307
#: sphinx/transforms/post_transforms/__init__.py:174
#, python-format
msgid "%r reference target not found: %%(target)s"
msgstr "%r referenca target nije pronađena: %% (target)"

Relates

#8943

askhl and others added 4 commits March 1, 2021 17:57
Spanish translation: fix bad substitution templates
… like msgfmt to verify that an incorrect translation cannot crash sphinx-build. This will fix current crashes for Hungarian and Greek (Spanish was fixed in sphinx-doc#8941)
@tk0miya tk0miya added this to the 4.0.0 milestone Mar 4, 2021
@tk0miya tk0miya changed the base branch from 3.5.x to master March 4, 2021 13:04
@tk0miya tk0miya merged commit 2477771 into sphinx-doc:master Mar 4, 2021
@tk0miya
Copy link
Member

tk0miya commented Mar 4, 2021

Thank you for your proposal. Merged into master branch.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants