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

Empty string should be translated to whatever translated and not the PO nonsense info #157

Open
AlmogCohen opened this issue Apr 16, 2015 · 11 comments

Comments

@AlmogCohen
Copy link

I know that the GNU gettext is overriding whatever we think and just replace empty string with nonsense information. Its time to stop the crime! Its time that we can control the empty string!

Most likely, it will be just super convenient to translate empty strings to empty strings!

I just make gzilion of problems that empty string is translated to this weird PO information. Is anybody see any reason to keep working that way even in the modern world of python??

Reference:
http://www.gnu.org/software/gettext/manual/gettext.html#MO-Files

@jun66j5
Copy link
Contributor

jun66j5 commented Apr 16, 2015

I don't want to change the behavior and break the compatibilities with gettext. Also, I use the behavior in http://trac-hacks.org/browser/tractimedeltaupdatorplugin/0.12/tractimedeltaupdator/web_ui.py?rev=12076&marks=142#L136.

@AlmogCohen
Copy link
Author

😢
I don't really get what did you meant by the behavior you linked to. Can you please elaborate more?

@jun66j5
Copy link
Contributor

jun66j5 commented Apr 16, 2015

That code is a part of my Trac plugin, which updates automatically relative time displays by javascript in Trac. To implement auto-updating feature, the plugin retrieves nplural value and plural expression in Plural-Forms header to user's preferred locale.

@AlmogCohen
Copy link
Author

maybe we should add some flag which change the behavior? You must admit that this behavior is very quirky and unexpected when using babel!

@sils
Copy link
Member

sils commented Oct 15, 2015

@erickwilder @etanol could I have your attention for this bug please? I do think this deserves a change, the behaviour of gettext in this case is totally bogus. However it breaks a defined API if we do it. Adding some flag which needs to be enabled explicitly might be a solution. I could see us changing the default on that for Babel 3 as this is indeed an API breaking change and thus needs a new major version.

@jun66j5 I see that there is a usecase for grabbing that kind of data but translating an empty message to some data isn't really a well thought out solution, a new function for that might do this as well and is way better readable and more obvious.

@jun66j5
Copy link
Contributor

jun66j5 commented Oct 15, 2015

I found another way to retrieve metadata of MO file using info() method of gettext.NullTranslations.

>>> import babel
>>> babel.__version__
'0.9.6'
>>> from babel.support import Translations
>>> tx = Translations.load('trac/locale', 'en_US')
>>> tx.info()['plural-forms']
'nplurals=2; plural=(n != 1)'

I'm going to change my Trac plugin with the info() method.

@etanol
Copy link
Contributor

etanol commented Oct 15, 2015

I'd appreciate a simple made up example for this particular scenario.

@AlmogCohen
Copy link
Author

@sils1297 Thanks for the attention and the detailed response. No need to translate empty string to something else. Translating to just old simple empty string will be quite enough!

@jeffoneill
Copy link

I just encountered this weird bug and would love to see it fixed.

@AlmogCohen
Copy link
Author

Any decisions on that matter? I have the feeling that even if I'll create a pull request fixing that, it will be rejected...

@sils
Copy link
Member

sils commented Mar 13, 2017

This project is basically dead and you will likely just not get any reviews, anyone volunteering to maintain it would be appreciated, we'll then figure out how to do a takeover.

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

No branches or pull requests

6 participants