update packages / nix packaging
This commit is contained in:
parent
230d3e5fe8
commit
536668d8b9
11 changed files with 254 additions and 180 deletions
|
@ -14,24 +14,24 @@ LANGUAGES = {
|
|||
|
||||
def get_locale() -> str:
|
||||
# if a user is logged in, use the locale from the user settings
|
||||
user = current_user # type: Optional[User]
|
||||
#user = current_user # type: Optional[User]
|
||||
return 'de'
|
||||
|
||||
# prefer lang argument
|
||||
if 'lang' in request.args:
|
||||
lang = request.args['lang'] # type: str
|
||||
if lang in LANGUAGES:
|
||||
if not isinstance(user, User):
|
||||
return lang
|
||||
user.locale = lang
|
||||
db.session.commit()
|
||||
# if 'lang' in request.args:
|
||||
# lang = request.args['lang'] # type: str
|
||||
# if lang in LANGUAGES:
|
||||
# if not isinstance(user, User):
|
||||
# return lang
|
||||
# user.locale = lang
|
||||
# db.session.commit()
|
||||
|
||||
if isinstance(user, User):
|
||||
return user.locale
|
||||
# otherwise try to guess the language from the user accept
|
||||
# header the browser transmits. We support de/fr/en in this
|
||||
# example. The best match wins.
|
||||
return request.accept_languages.best_match(['de'])
|
||||
# if isinstance(user, User):
|
||||
# return user.locale
|
||||
# # otherwise try to guess the language from the user accept
|
||||
# # header the browser transmits. We support de/fr/en in this
|
||||
# # example. The best match wins.
|
||||
# return request.accept_languages.best_match(['de'])
|
||||
|
||||
def get_timezone() -> Optional[str]:
|
||||
# user = getattr(g, 'user', None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue