I tried to translate my web app with 'babel' but i trapped with the error: "AttributeError: 'Babel' object has no attribute 'localeselector'" I use python 3.11.1 and Babel 2.11.0 This is the code related to the problem.
from flask_babel import Babel, get_locale, gettext
@babel.localeselector
def determine_locale():
if 'language' in session:
return session['language']
return request.accept_languages.best_match(['en', 'es'])
I succssesfully created all the files like (messages.pot, messages.po and messages.mo) using command promt. I think I have poor knowlages about decorators themselves, and can't figure out where to look to find solution.
I tried to import localeselector using different ways, and read a lot of examples from peoples who did manage with it. But still can'n get the point what the step I've missed.