class ExtendedRegisterForm(RegisterForm): all_locales = [('en', 'English')] for x in babel.list_translations(): all_locales.append((x.language, x.display_name)) email = StringField(lazy_gettext('E-Mail'), validators=[DataRequired(), Email()]) password = PasswordField( lazy_gettext('Password'), validators=[DataRequired(), EqualTo("password_confirm")]) password_confirm = PasswordField( lazy_gettext('Retype password'), validators=[DataRequired(), EqualTo("password")]) locale = SelectField(lazy_gettext('Language'), choices=all_locales) submit = None
def get_locale(): translations = [ str(translation) for translation in babel.list_translations() ] return request.accept_languages.best_match(translations)
def get_locale(): translations = [ str(translation) for translation in babel.list_translations() ] return request.accept_languages.best_match(translations)