i18n problem.

2,447 views
Skip to first unread message

gonza...@gmail.com

unread,
Mar 17, 2015, 8:00:34 AM3/17/15
to sel...@googlegroups.com
Hi, I'm using Select2 and I can't set the language successfully.

Im trying the next code (simplified):

$('#customers').select2({language: '/company/web/js/select2/i18n/es.js' });

the directory exists and is reachable from my browser. I've read the documentation several times:

https://select2.github.io/options.html#language

Cite:
When a string is passed in as the language, Select2 will try to resolve it into a language file. This allows you to specify your own language files, which must be defined as an AMD module.
---

I pass a valid language file and doesn't work, I'm doing something bad or there are a bug?

Any help will be appreciated!

Note: I've tried too to put: { language: 'es' } and a lot of variables with no effect

Kevin Brown

unread,
Mar 31, 2015, 6:22:10 PM3/31/15
to sel...@googlegroups.com
Sorry for not responding earlier.

You should be able to use `language: 'es'` to specify the language, but you have to make sure to include the language file in the page before you initialize Select2 (but after you include Select2). Select2 cannot automatically load files, unless you are in a strict AMD environment using an AMD loader (you aren't), so you still have to include them on the page.

For the examples page in the documentation we do this right at the top.

Kevin Brown


--
You received this message because you are subscribed to the Google Groups "select2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to select2+u...@googlegroups.com.
To post to this group, send email to sel...@googlegroups.com.
Visit this group at http://groups.google.com/group/select2.
For more options, visit https://groups.google.com/d/optout.

i.am....@gmail.com

unread,
Apr 7, 2016, 12:12:08 PM4/7/16
to select2, ke...@kevinbrown.in
Kevin can you point me about using language option dynamically (via RequireJS for example)?

Reading different issues i didn't realise how and when it needed to set correct setting(s)... =\

Reply all
Reply to author
Forward
Message has been deleted
0 new messages