# Path: lektor/uilink.py
# UI_LANG = None


import os
import json
from lektor.uilink import UI_LANG



translations_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                            'translations')
KNOWN_LANGUAGES = list(x[:-5] for x in os.listdir(translations_path)
                       if x.endswith('.json'))


translations = {}
for _lang in KNOWN_LANGUAGES:
    with open(os.path.join(translations_path, _lang + '.json')) as f:
        translations[_lang] = json.load(f)


def get_translations(language):
    """Looks up the translations for a given language."""
    return translations.get(language)


def is_valid_language(lang):
    """Verifies a language is known and valid."""
    return lang in KNOWN_LANGUAGES


def get_default_lang():
    """Returns the default language the system should use."""
    if UI_LANG is not None:

# Path: lektor/uilink.py
# UI_LANG = None


# Path: lektor/i18n.py
import os
import json
from lektor.uilink import UI_LANG




translations_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                            'translations')
KNOWN_LANGUAGES = list(x[:-5] for x in os.listdir(translations_path)
                       if x.endswith('.json'))


translations = {}
for _lang in KNOWN_LANGUAGES:
    with open(os.path.join(translations_path, _lang + '.json')) as f:
        translations[_lang] = json.load(f)


def get_translations(language):
    """Looks up the translations for a given language."""
    return translations.get(language)


def is_valid_language(lang):
    """Verifies a language is known and valid."""
    return lang in KNOWN_LANGUAGES


def get_default_lang():
    """Returns the default language the system should use."""
    if UI_LANG is not None:

        return UI_LANG