Questions tagged [python-babel]

Python internationalization library with an emphasis on web-based applications. Use with the [python] tag and any relevant version tags.

158 questions
1
vote
1 answer

Babel date_format returning 2016 for 2017 date

I'm trying to display the date formatted for the specified language and I'm little surprised to see that: babel.dates.format_date(date(2017,1,1), 'MMM Y') gives the expected value which is: u'Jan…
aguyngueran
  • 1,301
  • 10
  • 23
1
vote
0 answers

How to switch between two languages in Flask?

I want to make my site in two different languages, am using Flask-Babel for this purpose . Here is my settings.py configurations: LANGUAGES = { 'en': 'English', 'ru': 'Russian' } Here you can see a dictionary including the two languages…
Reznov
  • 175
  • 1
  • 3
  • 14
1
vote
1 answer

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…
Juan Perez
  • 13
  • 4
1
vote
0 answers

How to add i18n feature with mako template engine?

I am doing a sample to test that. myprj/setup.py requires = [ 'pyramid', 'pyramid_mako == 1.0.2', 'mako', 'Babel', 'lingua', ] setup(name='myprj', ... messages_extractors = { '.': [ ('**.py', 'lingua_python',…
ithelloworld
  • 2,207
  • 4
  • 16
  • 16
1
vote
1 answer

Jinja2 does not recognize translation

I am building a site with Pelican and following this guide on localizing templates. However, pelican output tells me: "ERROR: Cannot find translations for language 'en' in 'translations/' with domain 'flobin'. Installing NullTranslations." when I…
Flobin
  • 626
  • 1
  • 10
  • 26
1
vote
1 answer

flask babel in a jinja macro

I think I got babel translation working ok in my templates for simple strings like this: it translates well according to my messages.po But now in my forms I'd like to use this macro most of the…
euri10
  • 2,446
  • 3
  • 24
  • 46
1
vote
1 answer

How to set format as hour in babel.dates.format_date?

odoo ERP regroup by day as default : data[k] = babel.dates.format_date(v, format="dd MMM yyyy", locale=context.get('lang', 'en_US')). what i want to do is to change the format date from day to hour format. I try to change the previous code…
Yacino
  • 645
  • 2
  • 10
  • 32
1
vote
1 answer

Indicate a specific .mo file for Babel to load

The setup of the problem is simple enough: an user selects a language preference (this preference can be read from the user’s session); based on this choice, load the appropriate .mo from the available translations; (no separate domains are set up,…
isra
  • 21
  • 3
1
vote
1 answer

Flask-Babel not translating with Pluggable Views

I am trying to get Flask-Babel to work with Pluggable Views. Although the @babel.localeselector annotated function gets called as expected, translation is not actually occurring. I have set up a demo repo of my problem on…
1
vote
2 answers

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): ├── README.md ├── app │   ├── __init__.py │   ├── admin │   │   ├── __init__.py │   │   ├── user_admin.py │   ├── auth │   │   ├── __init__.py │   │  …
Sinux
  • 1,728
  • 3
  • 15
  • 28
1
vote
1 answer

Pybabel extract adds extra single quotes when extracting keywords from html templates

I have an App Engine app running python with jinja2 html templates. I am using pybabel to internationalize it. When i run the command pybabel extract -F babel.cfg -o ./locale/messages.pot ./ to extract from the templates, it adds extra single quotes…
bogen
  • 9,954
  • 9
  • 50
  • 89
1
vote
1 answer

Capitalize month's name in 'es' locale

I am trying to use a self-defined formatting for format_date. I want the month's name in upper case, and for that I am using MMMM yyyy or LLLL yyyy. I expect something along the lines of April 2007. Here is my test program: from datetime import…
blueFast
  • 41,341
  • 63
  • 198
  • 344
1
vote
1 answer

How can I print any float, like 1.234e22, in a long, nicely rounded and localized format in python?

There are a few existing questions about float formatting, but none answer the following question, I think. I'm looking for a way to print large floats in a long, nicely rounded and localized format: >>> print magic_format(1.234e22,…
MiniQuark
  • 46,633
  • 36
  • 147
  • 183
1
vote
2 answers

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: from…
1
vote
2 answers

lazy_gettext error on google app engine with python webapp2 babel

Background: I'm one of the primary contributors to gae-boilerplate, an open source boilerplate project to help users jump start development on google app engine with webapp2 and the latest features. The latest feature i've worked on is i18n using…