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 292 forks source link

Flask BabelEx Domains #296

Closed Chaostheorie closed 4 years ago

Chaostheorie commented 4 years ago

In the current build the user manager overwrites the default domain for the babel, if Flask BabelEx was initialized, which gives you the option to either miss out on Flask BabelEx for your own code or miss out on Flask User. I have for one of implemented a derivativ variant of the Flask User templates for this purpose and translated everything for the needed languages. Maybe as a workaround could the user_manager instead of editing the Babel object bound to app create a babel object and bind it to the Blueprint?

papdaniel commented 4 years ago

Yeah, I have the same problem. In Flask-User the Flask-Babelex not configurable, so we cannot add new translations... domain_translations = Domain(_translations_dir, domain='flask_user') here I tested it, if I create my own translations and change _translations_dir param here to point to my translations and init Flask-User before Flask-BabelEx it works fine. This way it doesn't touch the default domain. But it's hardcoded... The translations path should be configurable, like in Flask-Admin, and I think it shouldn't overwrite the BabelEx's default domain.