Skip to content

Tag: python-babel

Internationalization (i18n) not rendered using flask-babel and apache with mod_wsgi on Ubuntu instance

I have a web application developed using python 2.7.6, flask and deployed on a Apache Ubuntu server. For internationalization, the app uses the flask-babel package in order to translate into Thai. However, it seems that my translations/th/LC_messages/messages.po file is ignored. It works perfectly in my localhost but not in the server. To force the selection of the locale, I use

How does Python babel round numbers?

I’m building a financial website with the Flask framework and I’m currently writing unit tests for it. I’m using the Babel package to format money amounts and I hit upon rather strange rounding behaviour. I would expect rounding to be up in case of a 5, or to at least be consistent. But look at this: Why is this so,

Flask-Babel do not translate anything in a web project

Description of my usage: This is my project structure(basically base on Flask Web Development): Configuration in /babel.cfg and /app/ babel.cfg: app/ Then I follow the Flask-Babel document Run $ pybabel extract -F babel.cfg -o messages.pot . Run $ pybabel extract -F babel.cfg -k lazy_gettext -o messages.pot . They do have found all the gettexts and lazy_gettexts. Run $ pybabel init

How to sort collections based on current user locale on a Django site

I need to sort a collection of objects by a utf-8 string property (built via ActiveRecord). Currently the code is sorting by ASCII order via the order_by method, however this needs to be changed to locale.strcoll. Unfortunately using the built in locale functionality requires changing the culture for the entire application, not just the current request. I’ve looked at the