# Path: randtalkbot/utils.py
# LOCALE_DIR = path.join(RANDTALKBOT_DIR, 'locale')


from collections import OrderedDict
from .utils import LOCALE_DIR
import gettext
import logging
import os
import pycountry
    """Raises:
        LanguageNotFoundError: If unable to recognize some language.

    Returns:
        list<str>: Deduplicated list of languages' codes.
    """
    names = ''.join([c for c in names if c not in QUOTES])

    if names.strip().lower() in SAME_LANGUAGE_NAMES:
        return ['same']

    names = [name.strip() for name in names.split(',')]
    compact_names = filter(bool, names)
    languages_codes = map(_get_language_code, compact_names)
    unique_languages_codes = _get_deduplicated(languages_codes)
    return unique_languages_codes

def get_translation(languages):
    if not languages:
        languages = ['en']

    try:
        translation_instance = gettext.translation(
            'randtalkbot',
            localedir=LOCALE_DIR,
            languages=languages,
            )
    except OSError:
        translation_instance = gettext.translation(
            'randtalkbot',

# Path: randtalkbot/utils.py
# LOCALE_DIR = path.join(RANDTALKBOT_DIR, 'locale')


# Path: randtalkbot/i18n.py
from collections import OrderedDict
from .utils import LOCALE_DIR
import gettext
import logging
import os
import pycountry

    """Raises:
        LanguageNotFoundError: If unable to recognize some language.

    Returns:
        list<str>: Deduplicated list of languages' codes.
    """
    names = ''.join([c for c in names if c not in QUOTES])

    if names.strip().lower() in SAME_LANGUAGE_NAMES:
        return ['same']

    names = [name.strip() for name in names.split(',')]
    compact_names = filter(bool, names)
    languages_codes = map(_get_language_code, compact_names)
    unique_languages_codes = _get_deduplicated(languages_codes)
    return unique_languages_codes

def get_translation(languages):
    if not languages:
        languages = ['en']

    try:
        translation_instance = gettext.translation(
            'randtalkbot',
            localedir=LOCALE_DIR,
            languages=languages,
            )
    except OSError:
        translation_instance = gettext.translation(
            'randtalkbot',

            localedir=LOCALE_DIR,