How do I load translations?


#1

I don’t know how translations works. As per documentation, I set “language”:“es” in options but nothing happens. Plugin does not make any request to the translation file (“es.js”).
I’m using Select2 4.0.6-rc.1


#2

According to the documentation, “you must make sure to include the translation file in your page after Select2.” The Select2 widget will not load the translation file for you. (The documetation also mentions that some language bundles may be built into the Select2 build, but based on your results it seems that Spanish is not one of them.)


#3

I was loading the wrong file. It’s not the file that’s in ‘/src/js/select2/i18n/’, it is the one in ‘/dist/js/i18n/’.
Thanks for replaying me.


#4

Just to be precise, from my experience, to be able to use i18n, you must use select2 locally and not with CDN. This way you can load i18n files the right way.