flask-wtf
flask-wtf copied to clipboard
Integration of LocaleAwareNumberField and DateTimeField with Flask-Babel
wtforms offers the option to localize output of LocaleAwareNumberField based on the form.meta.locales attribute. Similary, DateTimeField accepts a format keyword argument for printing dates and times.
It would be nice to integrate these settings with flask_babel. I am aware that these fields are defined in wtforms and not in flask-wtf, but I believe that flask-wtf should be the place for integration with flask_babel. Currently, flask-wtf uses flask_babel.get_locale through the i18n.py module to get the current locale and to provide translations based on the locale.
Does anybody have an idea how get_locale could be used to provide automatic formatting to LocaleAwareNumberField and DateTimeField?