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
0
votes
1 answer
0
votes
0 answers

pybabel ignoring files with autoescape

I have a python web application with jinja2 templates. I am using pybabel for localization. When using the pybabel extract command, it exports everything exactly as intended, EXCEPT for any files which use the jinja2 autoescape tag. My babel.cfg…
Gwyn Howell
  • 5,365
  • 2
  • 31
  • 48
0
votes
1 answer

import error flask.ext.wtf import Form

i am following The Flask Mega tutorial, while importing flask.ext.wtf.form i get import error my code is - from flask.ext.wtf.form import Form from wtforms import StringField, BooleanField from wtforms.validators import DataRequired class…
0
votes
2 answers

TypeError: an integer is required (got type str)

I am new to Python and Flask. I am working my way throught this tutorials: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms Right now i am getting an error for which i can't find a fix for. I have reinstalled Python…
MarkerDave
  • 335
  • 1
  • 5
  • 13
0
votes
1 answer

Hide seconds in Babel's medium/long formats

We're using Babel to format datetime objects nicely according to the user's locale. In many cases we show data which does not contain non-zero seconds ever (such as real-life event start times). While it'd be easy with a custom format string to get…
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
0
votes
0 answers

Python (flask, babel): detect browser language (NOT preferred/ accepted languages)

Before flagging this question as 'duplicate'/ 'already answered', please take into consideration that this 'duplicates' all relate to the ACCEPTED_LANGUAGES headers field. The question is this: how to detect in Python the language a user has set for…
isra
  • 21
  • 3
0
votes
1 answer

Send character limit to transifex using babel or anything else

Is there a way to set character limits for a translation from within the template? I am currently using babel to generate pot files to push them to transifex. one of the tags i am sending is the translators comments -c TAG, --add-comments=TAG I was…
Razmig
  • 609
  • 1
  • 4
  • 10
0
votes
1 answer

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…
kramer65
  • 50,427
  • 120
  • 308
  • 488
0
votes
1 answer

How to use Python Babel with dynamically constructed string

I'm trying to use babel to extract and update a constructed string but I still haven't found a good way to do it (without any hassle) My current approach to construct the string: def calculate_money(amount): (usd, cent) = calculate(amount) …
Luan Nguyen
  • 993
  • 6
  • 14
0
votes
1 answer

Different translations of the same static html file: how is it possible to force the user's browser to select one of them?

I have several translations (into different languages) of the same static html file. Those were obtained via Sphinx-Python, using the internationalization feature, which ends up with mo files. All this works fine. However, I have no clue on how to…
mannaia
  • 860
  • 2
  • 11
  • 27
0
votes
1 answer

Python/Babel: Get locale-specific ordering of day, month and year?

Is there a way to get the day, month and year order for a locale in Babel? I am display three input fields for a date on a web page, and I would like to get the order correct based on the user's preferred language. I know there is…
Seth
  • 6,514
  • 5
  • 49
  • 58
0
votes
1 answer

Keep header in messages.pot using Flask-Babel pybabel extract

Is it possible to keep/set the header in the messages.pot, between execution? I found three options to control the header. But there is more info I would like to keep/set, like project name/version etc.…
Arlukin
  • 319
  • 1
  • 3
  • 12
0
votes
1 answer

How to configure my Python 2.7 to use the correct Babel installation on my OSX Mavericks system?

This is the follow up on my previous question. I have an OSX Mavericks machine where I installed Python 2.7 and Babel 1.3 using MacPorts. The problem is that it seems I have at least two versions of babel on that machine and except for the one I…
Ailete619
  • 194
  • 1
  • 18
0
votes
2 answers

I cannot find setup.py in my OSX babel installation to import the cldr babel files, what am I doing wrong?

I have been trying to use babel on my iMac (OSX Mavericks, I installed python and babel using MacPorts) but I get this error message : [...] writing PO template file to ./locale/messages.pot Traceback (most recent call last): File…
Ailete619
  • 194
  • 1
  • 18
0
votes
2 answers

How can I get a list of all the strings that Babel knows about?

I have an application in which the main strings are in English and then various translations are made in various .po/.mo files, as usual (using Flask and Flask-Babel). Is it possible to get a list of all the English strings somewhere within my…
AVB
  • 219
  • 1
  • 6
1 2 3
10
11