lingthio / Flask-User

Customizable User Authorization & User Management: Register, Confirm, Login, Change username/password, Forgot password and more.
http://flask-user.readthedocs.io/
MIT License
1.06k stars 294 forks source link

Custom (particularly Email) translations #261

Open alexander-myltsev opened 5 years ago

alexander-myltsev commented 5 years ago

I'm trying to translate email messages since Flask-User doesn't provide translations. BTW why?

I did everything according to https://flask-user.readthedocs.io/en/v0.6/internationalization.html. But there're lines: https://github.com/lingthio/Flask-User/blob/a379fa0a281789618c484b459cb41236779b95b1/flask_user/translation_utils.py#L13-L20 that always forces to use predefined translations. To make my translations work I have to hack:

    domain_translations = Domain(dirname='./translations', domain='flask_user')
    babel = Babel(app=app, default_domain=domain_translations)
    import flask_user.translation_utils as fu_tu
    fu_tu.domain_translations = domain_translations

What's the correct way to use custom translations?