# Path: src/slim/helpers.py
# def get_default_language():
# def get_languages():
# def get_languages_keys():
# def get_languages_dict():
# def get_language_from_request(request, default=default_language):
# def admin_change_url(app_label, module_name, object_id, extra_path='',
#                      url_title=None):
# def admin_add_url(app_label, module_name, extra_path='', url_title=None):
# def smart_resolve(var, context):


import re
from django import template
from django.template import Library
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from six import text_type
from ..helpers import (
    smart_resolve,
    default_language,
    get_language_from_request,
    get_languages_keys,
    get_languages_dict
)

    FIXME: This is actually a hack.

    Syntax::
        {% set_language [language] %}
    Example::
        {% set_language ru %}
    """
    bits = token.contents.split()
    if 2 < len(bits):
        raise template.TemplateSyntaxError(
            "'%s' tag takes one argument at most" % bits[0]
        )
    elif 2 == len(bits):
        language = parser.compile_filter(bits[1])
    else:
        language = None
    return SetLanguageNode(language=language)


class MultilinIsEnabledNode(template.Node):
    """Node for ``multiling_is_enabled`` tag."""

    def __init__(self, as_var=None):
        """Constructor."""
        self.as_var = as_var

    def render(self, context):
        """Render."""
        # Try to get request.LANGUAGE_CODE. If fail, use default one.

# Path: src/slim/helpers.py
# def get_default_language():
# def get_languages():
# def get_languages_keys():
# def get_languages_dict():
# def get_language_from_request(request, default=default_language):
# def admin_change_url(app_label, module_name, object_id, extra_path='',
#                      url_title=None):
# def admin_add_url(app_label, module_name, extra_path='', url_title=None):
# def smart_resolve(var, context):


# Path: src/slim/templatetags/slim_tags.py
import re
from django import template
from django.template import Library
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from six import text_type
from ..helpers import (
    smart_resolve,
    default_language,
    get_language_from_request,
    get_languages_keys,
    get_languages_dict
)


    FIXME: This is actually a hack.

    Syntax::
        {% set_language [language] %}
    Example::
        {% set_language ru %}
    """
    bits = token.contents.split()
    if 2 < len(bits):
        raise template.TemplateSyntaxError(
            "'%s' tag takes one argument at most" % bits[0]
        )
    elif 2 == len(bits):
        language = parser.compile_filter(bits[1])
    else:
        language = None
    return SetLanguageNode(language=language)


class MultilinIsEnabledNode(template.Node):
    """Node for ``multiling_is_enabled`` tag."""

    def __init__(self, as_var=None):
        """Constructor."""
        self.as_var = as_var

    def render(self, context):
        """Render."""
        # Try to get request.LANGUAGE_CODE. If fail, use default one.

        if len(get_languages_keys()) > 1: