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
3
votes
0 answers

Possible to create custom locale, such as fr_EN?

I am looking for a possibility to create a custom locale for my website. The website is available in several languages, including French. The French version of the website has particular content which is specific to France and not present in other…
Al Nikolaj
  • 305
  • 4
  • 13
3
votes
2 answers

Flask, Jinja2, Babel error on "$" character

I'm migrated my code from webapp2 to Flask. (I deploy my code in Google App Engine) However, I can no longer use this string: "Error: Max %1$d characters" Initialization flask_app = Flask(__name__) babel = Babel(flask_app,…
Blodhgard
  • 9,130
  • 3
  • 24
  • 36
3
votes
1 answer

Translation Interface for Flask Babel

Good evening, I'm developing an Python API app with Flask Framework and I used Flask Babel to translate content. It works with .po and .mo files. theme.po - this is a ASCII file (readable text). It's responsible for most of the text displayed on the…
vftw
  • 1,547
  • 3
  • 22
  • 51
3
votes
1 answer

Change language Flask Babel manually

I'm using Flask Babel to translate my Flask Python app. At moment I only have the translation mechanism by locale but what if the user besides his location wants to change the location to english? Is there any way to change the locale manually? This…
Verance
  • 137
  • 2
  • 13
3
votes
0 answers

Using Flask-Login and Flask-Babel together

I am constructing a multi-language app using Flask as well as using Flask-Login for authentication. My typical views look like this: @auth.route('/en/login/', endpoint="login_en", methods=['GET', 'POST']) @auth.route('/es/login/',…
Darwin Tech
  • 18,449
  • 38
  • 112
  • 187
3
votes
1 answer

Using links with babel in Jinja2

Currently I'm using Flask and Jinja2 in combination with Babel. So far everything is working great. The only problem I'm facing is when using links in a translated text. Let's say we have the following in HTML:

You can change this in your

Thorchy
  • 175
  • 10
3
votes
2 answers

Flask, Babel and python - ImportError: No module named babel

Despite installing babel I am rather amused yet annoyed that Flask and Babel do not work. pip install babel pip install Flask-Babel Traceback (most recent call last): File "run.py", line 8, in from app import app File…
Tampa
  • 75,446
  • 119
  • 278
  • 425
2
votes
1 answer

Flask-Babel language selector

Hello it is a pleasure to greet you, today I come to ask you for help with an error that Babel de Flask is presenting to me, I am new to the subject, but in advance I thank you for your collaboration. At the end of the code I show in a Quote the…
Khöug
  • 46
  • 7
2
votes
1 answer

Error when using flask babel in AppEngine

I'm working on my first Flask Babel project and hit a snag: NameError: name '_' is not defined I need to translate the texts and menus into different languages, later I will tackle numbers and dates. The pybabel extract and init commands work well…
kxtronic
  • 331
  • 5
  • 16
2
votes
1 answer

Flask-Babel convert Flask-WTF SelectField

I want to convert Flask-WTF SelectField value with Flask-Babel. Here is the snippet of my code: from flask_babel import _, lazy_gettext as _l class PaymentStatus(enum.Enum): REJECTED = 'REJECTED' COMPLETED = 'COMPLETED' EXPIRED =…
Tri
  • 2,722
  • 5
  • 36
  • 65
2
votes
2 answers

How do I add a link to change and keep a new language using babel and flask?

I have setup Babel correctly and the translation work as intended. What I am stuck with is to be able to switch languages using a link and than keep that setting active even if the user click on any other links on the web page. This is what my setup…
Salviati
  • 758
  • 2
  • 9
  • 28
2
votes
2 answers

KeyError: 'babel' - related to __init__.py - Not using Babel explicitly

I've been getting the same error for hours, no matter what code changes I make, and it's referencing Babel, a dependency I am not specifically calling or using, although I assume it's being called for a reason. It's coming from a function that is…
km457
  • 125
  • 2
  • 11
2
votes
0 answers

Flask change language with button

I'm using flask to build an app and flask-babel for translations, but i want that the user can change between languages with a button, how can I do this?
ragde
  • 35
  • 3
2
votes
3 answers

Flask + Flask-Security + Babel not working

I have setup with Flask + Babel + Flask Security. Created all translation like this: root main.py translations ru LC_MESSAGES messages.mo messages.po In main.py there is part to setup language which executes: @babel.localeselector def…
andjelx
  • 199
  • 1
  • 13
2
votes
1 answer

Flask-Babel Multiple Language URL Routing

I am creating a multi-language site (EN and FR) and I need it to toggle back and forth on click if the user so chooses. I am using Flask-Babel and the translations and toggle are working correctly on click, however, I need the URLs to be translated…
kbdev
  • 1,225
  • 1
  • 13
  • 33