Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable i18n support in JazzminSelect #601

Open
mardukbp opened this issue Sep 16, 2024 · 0 comments
Open

Enable i18n support in JazzminSelect #601

mardukbp opened this issue Sep 16, 2024 · 0 comments

Comments

@mardukbp
Copy link

In order to enable the i18n support for Select2 the media property of JazzminSelect should be defined as:

from django.contrib.admin.widgets import get_select2_language

@property
def media(self):
    i18n_lang = get_select2_language()
    i18n_js = (
        ("admin/js/vendor/select2/i18n/%s.js" % i18n_lang, "admin/js/jquery.init.js")
        if i18n_lang
        else ()
    )
    return forms.Media(
        css={"all": ("vendor/select2/css/select2.min.css",)},
        js=("vendor/select2/js/select2.min.js",) + i18n_js
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant