I would like to use Flask-Babel to localise content in the app. Now I understand how Flask-Babel works and it's used to localise static content.
I have created a number of forms using Flask-wtf and they use QuerySelectField to fetch data from the database. Here is the registration form that has a QuerySelectField.
from flask_babel import _, lazy_gettext as _l
class RegistrationForm(FlaskForm):
username = StringField(_l('Username'), validators=[DataRequired()])
email = StringField(_l('Email'), validators=[DataRequired(), Email()])
country = QuerySelectField(_l('Country'),
blank_text=u'-- please choose --',
query_factory=lambda: Country.query,
allow_blank=False)
password = PasswordField(_l('Password'), validators=[DataRequired()])
password2 = PasswordField(
_l('Repeat Password'), validators=[DataRequired(),
EqualTo('password')])
submit = SubmitField(_l('Register'))
Is there anyway the country values can be localised here using babel instead of having to stored countries in different languages in the database?