Opened 6 years ago

Last modified 6 years ago

#29944 closed Bug

Can't translate URL if activated language is different than the URL's — at Version 1

Reported by: Filip Kucharczyk Owned by: nobody
Component: Internationalization Version: 2.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Filip Kucharczyk)

What I'm trying to achieve:

  • Translate English URL to a different language, when activated language is different than English

Setup:
Everything as per docs in https://docs.djangoproject.com/en/1.11/topics/i18n/translation/#module-django.conf.urls.i18n

from django.urls import translate_url
from django.utils.translation import activate

url = '/en/'

# Translating english url with german language activated fails
activate('de')
print(translate_url(url, 'de'))  # '/en/'

# Works just fine with english language activated
activate('en')
print(translate_url(url, 'de'))  # '/de/'

Not sure if this ticket is valid as translate_url is not documented by the official docs, might be I'm using it wrongly?

Change History (1)

comment:1 by Filip Kucharczyk, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top