# Path: easymode/utils/languagecode.py
# USE_SHORT_LANGUAGE_CODES = getattr(settings, 'USE_SHORT_LANGUAGE_CODES', False)
#     STRIP_LANGUAGE_CODE_REGEX = re.compile(ur'/(?:%s)/' % "|".join(get_short_language_codes()))
#     STRIP_LANGUAGE_CODE_REGEX = re.compile(ur'/(?:%s)/' % "|".join(get_language_codes()))
# def get_language_codes():
# def get_short_language_codes():
# def get_all_language_codes():
# def get_shorthand_from_language_code(locale):
# def get_language_code_from_shorthand(short_locale):
# def strip_language_code(url):
# def fix_language_code(url, current_language):
# def get_real_fieldname(field, lang):
# def localize_fieldnames(fields, internationalized_fields):
# def get_language_codes_as_disjunction():


from django.template.defaultfilters import stringfilter
from django import template
from easymode.utils import languagecode


register = template.Library()

@register.filter
@stringfilter
def strip_locale(url):
    """Strip the language code from the beginning of a string"""
    return languagecode.strip_language_code(url)

@register.filter
def fix_locale_from_request(url, current_language):
    """
    Fixes the language code as follows:
    
    If there is only one language used in the site, it strips the language code.
    If there are more languages used, it will make sure that the url has the current
    language as a prefix.
    """

# Path: easymode/utils/languagecode.py
# USE_SHORT_LANGUAGE_CODES = getattr(settings, 'USE_SHORT_LANGUAGE_CODES', False)
#     STRIP_LANGUAGE_CODE_REGEX = re.compile(ur'/(?:%s)/' % "|".join(get_short_language_codes()))
#     STRIP_LANGUAGE_CODE_REGEX = re.compile(ur'/(?:%s)/' % "|".join(get_language_codes()))
# def get_language_codes():
# def get_short_language_codes():
# def get_all_language_codes():
# def get_shorthand_from_language_code(locale):
# def get_language_code_from_shorthand(short_locale):
# def strip_language_code(url):
# def fix_language_code(url, current_language):
# def get_real_fieldname(field, lang):
# def localize_fieldnames(fields, internationalized_fields):
# def get_language_codes_as_disjunction():


# Path: easymode/templatetags/easyfilters.py
from django.template.defaultfilters import stringfilter
from django import template
from easymode.utils import languagecode



register = template.Library()

@register.filter
@stringfilter
def strip_locale(url):
    """Strip the language code from the beginning of a string"""
    return languagecode.strip_language_code(url)

@register.filter
def fix_locale_from_request(url, current_language):
    """
    Fixes the language code as follows:
    
    If there is only one language used in the site, it strips the language code.
    If there are more languages used, it will make sure that the url has the current
    language as a prefix.
    """

    return languagecode.fix_language_code(url, current_language)