mitsuhiko/flask-babel — pull request #22 by longfin (2012-03-17 08:23:34+00:00)
Title: apply unicode() when gettext()(or ngettext()) received string argument and translations have it's own charset.

If target translations contain own charset(ex. utf-8), GNUTranslations convert it's key to unicode.

```python
# gettext.py

def _parse(self, fp):
# ...
if '\x00' in msg:
# Plural forms
msgid1, msgid2 = msg.split('\x00')
tmsg = tmsg.split('\x00')
if self._charset:
msgid1 = unicode(msgid1, self._charset)
tmsg = [unicode(x, self._charset) for x in tmsg]
for i in range(len(tmsg)):
catalog[(msgid1, i)] = tmsg[i]
else:
if self._charset:
msg = unicode(msg, self._charset)
tmsg = unicode(tmsg, self._charset)
catalog[msg] = tmsg
```

I can't access them via flask-babel's _() in jinja2 because argument of that is utf-8 encoded string, not unicode. so I changed init_app() to install different version of functions to app.jinja_env.

Please check and comment if it's not necessary. thanks.