Questions tagged [flask-babel]

Flask-Babel is an extension to Flask that adds i18n and l10n support to any Flask application.

Flask-Babel is an extension to Flask that adds i18n and l10n support to any Flask application with the help of babel, pytz and speaklater.

It has builtin support for date formatting with timezone support as well as a very simple and friendly interface to gettext translations.

77 questions
1
vote
1 answer

how to translate inside a loop using flask-babel

I'm having a hard time figuring out how to use flask-babel to translate variables inside a loop. Give this (non-working) example what would I need to change for each iteration to have it's own translation? {% for key, values in products.items() %} …
Alex
  • 63
  • 5
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

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

Cant route urls with Flask-babel and blueprints when url doesnt specify language

I have been digging around Flask-babel for a while and cant seem to get the url routing with a simple blueprint. Here's the trimmed down app on my __ init __.py file, app = Flask(__name__) babel.init_app(app) @babel.localeselector def…
Shankar ARUL
  • 12,642
  • 11
  • 68
  • 69
0
votes
1 answer

How do I install Python Babel library in it's trunk version?

After hours of finding out why there are missing some documented functions in my Babel installation, I learned there are two branches of Babel development: Babel has two separate development paths (0.9.x branch and trunk) in parallel for about 4…
Honza Javorek
  • 8,566
  • 8
  • 47
  • 66
0
votes
0 answers

Flask-Babel in flask app factory method not translating text (but does translate when not using a factory method)

Trying to get flask-babel to work in a factory method. I've got it working in a simple flask app (without a factory) but as soon as I try using an app factory the "gettext" or "_" doesnt seem to translate the text. I found this other very similar…
0
votes
1 answer

Is there a way to replace jinja2.ext.autoescape and jinja2.ext.with_ in Flask Babel?

I'm using Flask Babel for web translation: When I write my config file like the following, it doesn't find any translations and the error is that jinja2.ext.autoescape and jinja2.ext.with_ are deprecated. babel.cfg [python: **.py] [jinja2:…
0
votes
0 answers

Flask-Babel Default Time Zone

In the Flask-Babel documentation there is a configuration setting for the default time zone, which is described as: BABEL_DEFAULT_TIMEZONE: The timezone to use for user facing dates. This defaults to 'UTC' which also is the timezone your…
SignalOne
  • 15
  • 5
0
votes
1 answer

Let Flask-Babel use default locale's msgstr if the msgstr in the requested locale is empty

We would like to use Flask-Babel for the internationalizing of our Flask application. Our goal is to use a unique ID string like "example_demo_text" for msgid and translate this msgid in several languages. Our process works like this: use the unique…
HaKePlan
  • 25
  • 1
  • 1
  • 7
0
votes
2 answers

How to translate .po file

I have a flask app and i wanted to add multiple languages to it. So i have using this demo on Flask_babel to do this. Flask Label Demo config.py DEBUG = True LANGUAGES = ['en', 'de', 'fr'] This is the app.py from flask import Flask, request, g from…
Aarushi
  • 544
  • 1
  • 5
  • 15
0
votes
1 answer

How to use flask babel gettext in celery?

I have a flask-celery setup with flask babel translating my texts. I can't translate in celery tasks. I believe this is because it doesn't know the current language (I'm not it could even if it did) and this is because celery doesn't have access to…
David Bensoussan
  • 2,887
  • 2
  • 38
  • 55
0
votes
0 answers

Flask-Security, dynamic url prefix for multilingual page (with Flask-Babelex)

I am adding Flask-Babelex to my website. I register blueprints with url_prefix as such: from app.main import bp as main_bp app.register_blueprint(main_bp, url_prefix="/") I set up babel.localeselector as…
igorto
  • 23
  • 1
  • 6
0
votes
0 answers

flask_babel flash doesn't update in GAE in production

I'm implementing i18n with flask_babel like below and it works in local server. However it doesn't work in production after deploy. It can show translated with "_('English')", however it does show {{ _('English')}} as is in HTML. Is there any way to…
Emiko
  • 21
  • 1
0
votes
1 answer

How to import _ from flask_babel without throwing key error

I am importing a sub module into a parent module and getting a key error. The sub module code (pruned) is as follows. from flask_babel import _ #def _(intext): return intext ... code ... class Result: ... code ... msglib = { 'ok': …
Mark Kortink
  • 1,770
  • 4
  • 21
  • 36