Beispiel #1
0
def reverse(*args, **kwargs):
    reverse_kwargs = kwargs.get('kwargs') or {}
    locale = utils.supported_language(
        reverse_kwargs.pop('locale', translation.get_language()))
    url = django_reverse(*args, **kwargs)
    _, path = utils.strip_script_prefix(url)
    return utils.locale_url(path, locale)
def reverse(*args, **kwargs):
    reverse_kwargs = kwargs.get('kwargs', {})
    locale = utils.supported_language(reverse_kwargs.pop('locale',
            translation.get_language()))
    url = django_reverse(*args, **kwargs)
    _, path = utils.strip_script_prefix(url)
    return utils.locale_url(path, locale)
Beispiel #3
0
def rmlocale(url):
    """Removes the locale prefix from the URL.
    
    The URL is expected to have the same script prefix as the current page."""
    script_prefix, path = utils.strip_script_prefix(url)
    _, path = utils.strip_path(path)
    return ''.join([script_prefix, path])
Beispiel #4
0
def chlocale(url, locale):
    """
    Changes the URL's locale prefix if the path is not locale-independent.
    Otherwise removes locale prefix.
    """
    _, path = utils.strip_script_prefix(url)
    _, path = utils.strip_path(path)
    return utils.locale_url(path, locale)
Beispiel #5
0
def chlocale(url, locale):
    """
    Changes the URL's locale prefix if the path is not locale-independent.
    Otherwise removes locale prefix.
    """
    _, path = utils.strip_script_prefix(url)
    _, path = utils.strip_path(path)
    return utils.locale_url(path, locale)
Beispiel #6
0
def chlocale(url, locale):
    """
    Changes the URL's locale prefix if the path is not locale-independent.
    Otherwise removes locale prefix.
    
    The URL is expected to have the same script prefix as the current page.
    """
    script_name, path = utils.strip_script_prefix(url)
    _, path = utils.strip_path(path)
    return utils.locale_url(path, locale, script_name)
Beispiel #7
0
def reverse(*args, **kwargs):
    reverse_kwargs = kwargs.get('kwargs') or {}
    prefix = kwargs.get('prefix') or None
    urlconf = kwargs.get('urlconf') or None

    if urlconf is None:
        urlconf = get_urlconf()

    locale = utils.supported_language(reverse_kwargs.pop(
            'locale', translation.get_language()))
    url = django_reverse(*args, **kwargs)
    stipped_prefix, path = utils.strip_script_prefix(url, prefix = prefix)
    return utils.locale_url(path, locale, prefix = prefix, urlconf=urlconf)
Beispiel #8
0
def rmlocale(url):
    """Removes the locale prefix from the URL."""
    script_prefix, path = utils.strip_script_prefix(url)
    _, path = utils.strip_path(path)
    return ''.join([script_prefix, path])
Beispiel #9
0
def rmlocale(url):
    """Removes the locale prefix from the URL."""
    script_prefix, path = utils.strip_script_prefix(url)
    _, path = utils.strip_path(path)
    return ''.join([script_prefix, path])
Beispiel #10
0
def reverse(*args, **kwargs):
    reverse_kwargs = kwargs.get("kwargs", {}) or {}
    locale = utils.supported_language(reverse_kwargs.pop("locale", translation.get_language()))
    url = django_reverse(*args, **kwargs)
    script_name, path_info = utils.strip_script_prefix(url)
    return utils.locale_url(path_info, locale, script_name)