Check on new-lines for gettext-based content
Categories
(Webtools Graveyard :: Pontoon, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: theo, Assigned: mathjazz)
Details
Attachments
(1 file)
Not sure if we already have some gettext checks in place, but would it be possible to prevent adding new lines when the source string doesn’t end with one in the .pot file? And similarly, to force adding a new line if the source ends with one?
compilemessages
throws a fatal msgfmt
error if the source/translation are not matching new lines:
Execution of msgfmt failed: /app/donate/locale/pt_BR/LC_MESSAGES/django.po:165: 'msgid' and 'msgstr' entries do not both end with '\n'
msgfmt: found 1 fatal error
CommandError: compilemessages generated one or more errors.
This fixed the error above: https://github.com/mozilla/donate-wagtail/commit/586a6a098b144e92d638e9b9f223afaa47baf423
Comment 1•5 years ago
|
||
More context on what msgformat
is doing on https://www.gnu.org/software/gettext/FAQ.html#newline.
Assignee | ||
Comment 2•5 years ago
|
||
We already warn about newlines
.
But I guess we should prevent overriding the check, like we do for .lang files?
https://github.com/mozilla/pontoon/blob/master/pontoon/checks/libraries/pontoon_db.py#L42-L47
Assignee | ||
Updated•4 years ago
|
Comment 3•4 years ago
|
||
Or we hand-craft a check like we do for .lang. The caveat about the TT check is that it also enforces in-content differences in newlines, not only end-of-content ones. Which is what we need here, AFAICT.
Comment 4•4 years ago
|
||
Assignee | ||
Comment 5•4 years ago
|
||
Updated•3 years ago
|
Description
•