radiac / django-tagulous

Fabulous Tagging for Django
http://radiac.net/projects/django-tagulous/
Other
332 stars 65 forks source link

Customize select2 language option #150

Open bernhardmiller opened 2 years ago

bernhardmiller commented 2 years ago

Hello,

I'm currently integrating this library in one of my projects. Thank you for creating it, it really is a great experience so far!

I'm currently stuck with localizing the texts shown by select2 (eg the "No results found" message when there are no tags). Usually, this is done with

$("#elem").select2({
  "language": {
      noResults: function () {
        return "Kein Ergebnis gefunden";
      },
  },
});

Is there a way to do this with tagulous? I tried with the autocomplete_settings like this:

tagulous.models.TagField(
    blank=True,
    autocomplete_settings={
        "language": {"noResults": "function() { return 'Keine Tags gefunden'; }"},
    },
)

but that did not work. Any help is appreciated!