python-babel / flask-babel

i18n and l10n support for Flask based on Babel and pytz
https://python-babel.github.io/flask-babel/
Other
444 stars 159 forks source link

Support of printf-style string formatting in lazy_gettext #97

Closed samjy closed 8 years ago

samjy commented 8 years ago

Recent changes to speaklater removed the ability to use printf-style formatting on lazy_gettext

E.g. this used to work before a5f22978c909c006cda45628193d90932c94ac6b

>>> hello = lazy_gettext(u'Hello %(name)s!')
>>> assert hello % {'name': 'Peter'} == 'Hello Peter!'
TypeError: unsupported operand type(s) for %: 'LazyString' and 'dict'
TkTech commented 8 years ago

Bugfix version v0.11.1 is available on pypi. Thanks for the report!

TkTech commented 8 years ago

@samjy Hah, I was fixing this from the phone and didn't even notice this was a PR not a ticket. Don't I feel silly.

Thanks for the report and the bugfix.

samjy commented 8 years ago

@TkTech Thanks for merging this so fast. I had left __rmod__ out of my PR, it indeed makes sense to have it back too.