Skip to content

i18n Language Chooser stripping admin paths/urls of language code wherever found #510

@Parthian

Description

@Parthian

My language changes between en-gb and es work fine except for the special case where es/ is in the path.
E.g.
domain.com/humanresources/employee and then switch to Spanish. Works fine. Then switch back to English.
Code somewhere goes looking for es/ and removes it whereever found thus:
domain.com/humanresoureemployee and a 404 is the result.

I've battled with numerous urls.py approaches (i18n_patterns etc) and it always happens.
When I remove Jazzmin my Admin can change language via the clever Chrome>Settings>Languages>Preferred Languages then 3dots menu and Move to Top. So I change languages without clicking any buttons.

With the urls.py below I see no en-gb/ nor es/ in the path. Which is prettier. Previous urls.py approaches (which I'd struggle to replicate) had the en-gb/ or es/ in the path. Before turning on Jazzmin "language_chooser": True, I used to manually change the path to jump between languages and the problem existed then too.

urlpatterns = [
    path("i18n/", set_language, name='set_language'),
    path('', admin.site.urls)
]

I imagine this would happen with e.g. en/ for English and an app called token (tokEN/somemodel). Maybe no one happens to have the correct combination of paths. And to think I thought about calling the app humanresource - which would have bypassed the problem.

It would be great if someone could replicate it or rule it out as Jazzmin.
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting changesNeeds changes from the authorbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions