django-rosetta
django-rosetta copied to clipboard
Rosetta permits to save broken translations for python-formatted messages
We have a problem when a Rosetta user mistypes a Python format placeholder in the translation. For example, you can have a translatable message code:
START_PLAYING_WITH_CASH %(points_description)s
Then someone is allowed to save:
Start playing with Cash to earn %points_description)s
When we run manage.py compilemessages afterwards, we get an error:
CommandError: Execution of msgfmt failed: /srv/frontend/locus-casino/gluster/translations/common/locale/en/LC_MESSAGES/django.po:220: 'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: In the directive number 1, the character 'p' is not a valid conversion specifier.
msgfmt: found 1 fatal error
+1
Sorry I'm new to Rosetta. I see that Rosetta prompts an error message but I can still click on "Save" and ignore this error message. Is it possible to forbid saving broken translation in this case?
Version: 0.7.13

+1
same problem, in our case rosetta allows saving this type of translations:
msgid "Incomplete programs - %(count)d"
msgstr "Incomplete programs"
or
msgid "Daily to do list - {}"
msgstr "Daily to do list"
I'd like to point out that, 8 years after this issue has been opened, this should be considered a fatal bug: For my company, this has been the cause of several total system failures, due to translators (not always being familiar with string-interpolation syntax, and understandably so.
I'd like to point out that, 8 years after this issue has been opened, this should be considered a fatal bug: For my company, this has been the cause of several total system failures, due to translators (not always being familiar with string-interpolation syntax, and understandably so.
I'm sorry, complaining in the comments that an issue hasn't yet been fixed won't improve things, this is not how open source software works.
If you feel this is a "fatal" bug and critical to your company to the point that it caused "several total system failures", you're most welcome to either a) submit a pull request, or b) propose a bounty for someone to fix it for you.
@mbi Thanks for your response.
Pointing out severity of bugs, is actually a fundamental part of open source.
For newcomers to the project (like me), that not familiar with the codebase, it is often a lot of work to fix issues such as these, even though it could be a trivial matter for an active contributor (such as yourself, I'm assuming). This, for me, is generally the reason behind my choice on whether to open an issue, or to pull-request.
@mbi if you don't feel like keeping your own project free from bugs, such as these, yourself, you can always ask someone (e.g. the person that opened the issue), if they want to submit a pull-request, and how they should go about it. In the end, we all want to have a bug-free django-rosetta.
But I gotta say; not responding for 8 years, or giving a (false) lecture on the workings of opensource software, probably isn't the most motivating way to ask a newcomer to contribute to your project.
That being said, are you planning to fix this youself @mbi , or would you like me to give it a try?
For newcomers to the project (like me), that not familiar with the codebase, it is often a lot of work to fix issues such as these, even though it could be a trivial matter for an active contributor (such as yourself, I'm assuming). This, for me, is generally the reason behind my choice on whether to open an issue, or to pull-request.
In which case, instead of complaining that the bug hasn't been fixed yet, why didn't you ask for pointer how to fix it? :wink:
I'd have gladly told you you should take a look here, which is where we check for the validity of python format strings in translated blocks.
I'd also have pointed out the complicated bits with this approach, namely:
- There can be multiple plurals, and possibly more or fewer translations than int the source language
- The order of the of the variables can change in the translations
- The validation is done in JavaScript at the moment, but you probably should also validate in the back-end if you want to be sure.
That being said, are you planning to fix this youself @mbi , or would you like me to give it a try?
Well, here is the thing: if this bug has gone unfixed for 9 years, it's clearly more critical to you than to me or anyone else, so as I said above please take look yourself, or set out a bounty for someone to fix it for you. Either way PRs are welcome, thanks!