I am new to Flask and Babel and I have just started a project which will contain several languages. After I have generated the babel.cfg file, when I attempt to extract it with the command pybabel extract -F babel.cfg -o messages.pot ., I get the AttributeError: module ‘jinja2.ext’ has no attribute ‘autoescape’ error. What can be the reason for this
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/__init__.py babel.cfg: app/__init__.py: 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
Python Unit test with i18 but without webapp2
I encountered a problem with unit tests when use i18 in my project. My project uses framewoks i18 and webapp2 The function uses the translation by i18. But when I test, I get the error – missing global variable request. For example it is: and I have message: I have a solution to this problem, but I do not like
How to enable timezones with babel in my jinja filter?
I want to use timezones according to the babel locale. How can I achieve this? The specific situation I have is the goal of displaying the date and time of an article and a humanized and localized way eg: Yesterday 13:21 or if the Swedish language parameter is set it will display Igår 13:21 And if the date wasn’t yesterday
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