<commit_before>from browser import document as doc
from browser.html import *

trans_menu = { 
    'menu_console':{'en':'Console','es':'Consola','fr':'Console', 'pt':'Console'},
    'menu_editor':{'en':'Editor','es':'Editor','fr':'Editeur', 'pt':'Editor'},
    'menu_gallery':{'en':'Gallery','es':'Galería','fr':'Galerie', 'pt':'Galeria'},
    'menu_doc':{'en':'Documentation','es':'Documentación','fr':'Documentation', 'pt':'Documentação'},
    'menu_download':{'en':'Download','es':'Descargas','fr':'Téléchargement', 'pt':'Download'},
    'menu_dev':{'en':'Development','es':'Desarrollo','fr':'Développement', 'pt':'Desenvolvimento'},
    'menu_groups':{'en':'Community','es':'Comunidad','fr':'Communauté', 'pt':'Comunidade'}
}
links = {'home':'index.html',
    'console':'tests/console.html',
    'editor':'tests/editor.html',
    'gallery':'gallery/gallery_%s.html',
    'doc':'static_doc/%s/intro.html',
    'download':'https://github.com/brython-dev/brython/releases',
    'dev':'https://github.com/brython-dev/brython',
    'groups':'groups.html'
}

def show(prefix='', language=None):
    # detect language
    has_req = False

    if language is None:
        qs_lang = doc.query.getfirst("lang")
        if qs_lang and qs_lang in ["en","fr","es","pt"]:
            has_req = True
            language = qs_lang
        else:
            import locale
            try:
                lang,enc = locale.getdefaultlocale()
                lang = lang[:2]
                if lang in ["en","fr","es","pt"]:
                    language = lang
            except:
                pass
<commit_msg>In header.py, use __BRYTHON__.language instead of module locale<commit_after>from browser import document as doc
from browser.html import *

trans_menu = { 
    'menu_console':{'en':'Console','es':'Consola','fr':'Console', 'pt':'Console'},
    'menu_editor':{'en':'Editor','es':'Editor','fr':'Editeur', 'pt':'Editor'},
    'menu_gallery':{'en':'Gallery','es':'Galería','fr':'Galerie', 'pt':'Galeria'},
    'menu_doc':{'en':'Documentation','es':'Documentación','fr':'Documentation', 'pt':'Documentação'},
    'menu_download':{'en':'Download','es':'Descargas','fr':'Téléchargement', 'pt':'Download'},
    'menu_dev':{'en':'Development','es':'Desarrollo','fr':'Développement', 'pt':'Desenvolvimento'},
    'menu_groups':{'en':'Community','es':'Comunidad','fr':'Communauté', 'pt':'Comunidade'}
}
links = {'home':'index.html',
    'console':'tests/console.html',
    'editor':'tests/editor.html',
    'gallery':'gallery/gallery_%s.html',
    'doc':'static_doc/%s/intro.html',
    'download':'https://github.com/brython-dev/brython/releases',
    'dev':'https://github.com/brython-dev/brython',
    'groups':'groups.html'
}

def show(prefix='', language=None):
    # detect language
    has_req = False

    if language is None:
        qs_lang = doc.query.getfirst("lang")
        if qs_lang and qs_lang in ["en","fr","es","pt"]:
            has_req = True
            language = qs_lang
        else:
            lang = __BRYTHON__.language
            if lang in ["en","fr","es","pt"]:
                language = lang

{'fraction_non_alphanumeric': 0.2220083413538659, 'fraction_numerical': 0.0003208213025344883, 'mean_word_length': 3.9492063492063494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2870345', 'n_tokens_mistral': 1099, 'n_tokens_neox': 992, 'n_words': 144}