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)
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])
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)
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)
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)
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)
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])
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])
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)