<commit_before>from flask.globals import request
from flask_login.utils import current_user
from waitlist.utility.account.helpers import get_locale_code
from babel.core import Locale, UnknownLocaleError
from typing import Any


def get_locale(app):
    lang_code = get_locale_code(current_user)
    return fix_locale_and_get(lang_code, app)


def fix_locale_and_get(lang_code: str, app: Any) -> Locale:
    from waitlist import db
    if lang_code is None or lang_code not in app.config['LANGUAGES']:<commit_msg>added debug log to getting locale<commit_after>from flask.globals import request
from flask_login.utils import current_user
from waitlist.utility.account.helpers import get_locale_code
from babel.core import Locale, UnknownLocaleError
from typing import Any
import logging

logger = logging.getLogger(__name__)


def get_locale(app):
    lang_code = get_locale_code(current_user)
    return fix_locale_and_get(lang_code, app)


def fix_locale_and_get(lang_code: str, app: Any) -> Locale:
    from waitlist import db
    logger.debug('lang_code: %s', lang_code)
    if lang_code is None or lang_code not in app.config['LANGUAGES']:
{'fraction_non_alphanumeric': 0.06830122591943957, 'fraction_numerical': 0.0, 'mean_word_length': 5.606936416184971, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4205498', 'n_tokens_mistral': 365, 'n_tokens_neox': 354, 'n_words': 105}