I have figured out today that this gem uses select2 in version 3.5.4 that has big flaw in its localization module - you cannot really work with multiple languages as select will always use the last included
this is due to the two facts
every localization file contains following line of code
i.e $.fn.select2.defaults gets overwritten by the latest included file
and
2) following piece from select2.js:1054:
if (opts.language != null) {
var lang = opts.language;
// formatNoMatches -> language.noMatches
if ($.isFunction(lang.noMatches)) {
opts.formatNoMatches = lang.noMatches;
}
contains two major flaws:
var lang = opts.language; will not result in expected object with translations but with string causing all subsequent calls of ($.isFunction(lang.noMatches) fail. this may be fixed by changing this line to var lang = $.fn.select2.locales[opts.language];
but it won't help anyway as locale files do not contain definition of noMatches function but (at that point obsolete) formatNoMatches so this calls for modifying all subsequent parts of this section
so to summarize this - it will not work as expected unless you hard fix the underlaying select2.js
I have figured out today that this gem uses select2 in version 3.5.4 that has big flaw in its localization module - you cannot really work with multiple languages as select will always use the last included
this is due to the two facts
i.e $.fn.select2.defaults gets overwritten by the latest included file
and
2) following piece from select2.js:1054:
contains two major flaws:
var lang = opts.language;
will not result in expected object with translations but with string causing all subsequent calls of($.isFunction(lang.noMatches)
fail. this may be fixed by changing this line tovar lang = $.fn.select2.locales[opts.language];
noMatches
function but (at that point obsolete)formatNoMatches
so this calls for modifying all subsequent parts of this sectionso to summarize this - it will not work as expected unless you hard fix the underlaying select2.js