#29944: Can't translate URL if activated language is different than the URL's -------------------------------------+------------------------------------- Reporter: Pacu2 | Owner: nobody Type: Bug | Status: new Component: | Version: 2.1 Internationalization | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Description changed by Pacu2:
Old description: > What I'm trying to achieve: > - Translate English URL to a different language, when activated language > is different than English > > {{{ > 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? New description: 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? -- -- Ticket URL: <https://code.djangoproject.com/ticket/29944#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.452298b961448fd2b9b4fc10eb61ac08%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.