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

Rosetta permits to save broken translations for python-formatted messages #128

Open
AdamDz opened this issue Mar 11, 2015 · 6 comments
Open

Comments

@AdamDz
Copy link

AdamDz commented Mar 11, 2015

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
@lingxiaoyang
Copy link

+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

image

@NeveHanter
Copy link

+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"

@jorenham
Copy link

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.

@mbi
Copy link
Owner

mbi commented Apr 21, 2023

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.

@jorenham
Copy link

@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?

@mbi
Copy link
Owner

mbi commented Apr 21, 2023

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? 😉

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants