def _load_translation(directory, domain):
    for lang in os.listdir(directory):
        if lang.startswith('.'):
            continue
        if os.path.isfile(os.path.join(directory, lang)):
            continue

        if not os.path.exists(os.path.join(directory, lang, "LC_MESSAGES", domain + ".mo")):
            continue

        gettext_translations = gettext.translation(domain, directory, languages=[lang], class_=WebtoolsTranslation)
        if lang in t_locale._translations:
            t_locale._translations[lang].merge(gettext_translations)
        else:
            t_locale._translations[lang] = gettext_translations
dataset/ETHPy150Open niwinz/tornado-webtools/webtools/utils/locale.py/_load_translation/original