Skip to content

Language switcher not working correctly when prefix_default_language=False #1109

@gleniat

Description

@gleniat

What version of Unfold are you using?

0.49.1

What version of Django are you using?

5.1

What browser are you using?

Chrome

Did you checked changelog/commit history, if the bug is not already fixed?

Yes

Did you searched other issues, if the bug is not already fixed?

Yes

Did you checked documentation?

Yes

Is example in docs working?

See https://unfoldadmin.com/docs/multi-language/

If I use the code from the example

urlpatterns = (
    [
        path("i18n/", include("django.conf.urls.i18n")),
    ]
    + i18n_patterns(
        path("admin/", admin.site.urls),
    )
)

I get:
/en/admin/ .. English language (default)
/de/admin/ .. German language

...and language switcher works correctly.

Describe your issue

When I set Django to have the default language without prefix:

urlpatterns = (
    [
        path("i18n/", include("django.conf.urls.i18n")),
    ]
    + i18n_patterns(
        path("admin/", admin.site.urls),
        prefix_default_language=False,
    )
)

I get:
/admin/ .. English language (default)
/de/admin/ .. German language

... and language switcher works PARTIALLY. User can switch to the German language, but cannot switch back to the default language using the language switcher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions