Skip to content

Language selection and different domains #307

@aliev

Description

@aliev

Language switching does not work in a domain that has already been assigned to the language.
The middleware class: https://github.com/WeFindX/infinity/blob/master/src/apps/core/middleware/language.py

It is necessary to apply the decorator for the function and change the logic of its work. The view of language switcher: https://github.com/django/django/blob/master/django/views/i18n.py#L28

Usage example (with new decorator)

from core.utils import custom_set_language
url(r'^set-language/$', custom_set_language(set_language), name="custom_set_language"),

Decorator description

def custom_set_language(func):
    def wrapper(request):
        return func(request)
    return wrapper

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions