Bootstrap-select: how to use i18n

Created on 26 Nov 2014  Â·  13Comments  Â·  Source: snapappointments/bootstrap-select

Hello, is it possible to have a guide for use other languafe in i18n?
i need to load Italian language for this component, whan can i do it?

thank you

Most helpful comment

Simply load the language file after bootstrap-select.

```html

All 13 comments

@valix85 you just need to load the javascript file with the language you want after the main selectpicker.js file but before your first call to .selectpicker();

As long as the file is loaded before your first call (and after the main file that loads in selectpicker) it should be good to go.

ok, it's work!
thank you very much

LIKE THIS

Only put the language.js and it works

I've been trying to figure out how to do this for days and can't get it to work. I emailed Silvio to no avail. Could someone please post complete example of how to use the right locale file when using this module?

Simply load the language file after bootstrap-select.

```html

This doesn't seem to work. Still seeing English text within the dropdown
for "select all" and "deselect all".

On Wed, Jun 28, 2017 at 8:16 PM, Casey Holzer notifications@github.com
wrote:

Simply load the language file after bootstrap-select.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/silviomoreto/bootstrap-select/issues/813#issuecomment-311826989,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEpgqY_zTBldCP8rQ0G6-Ap3rgDhYpNks5sIuzXgaJpZM4DA5nR
.

So, it does work. Just turns out these are not translated for German. Thanks

On Thu, Jun 29, 2017 at 10:27 AM, Doug Farmer doug4641@gmail.com wrote:

This doesn't seem to work. Still seeing English text within the dropdown
for "select all" and "deselect all".

On Wed, Jun 28, 2017 at 8:16 PM, Casey Holzer notifications@github.com
wrote:

Simply load the language file after bootstrap-select.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/silviomoreto/bootstrap-select/issues/813#issuecomment-311826989,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEpgqY_zTBldCP8rQ0G6-Ap3rgDhYpNks5sIuzXgaJpZM4DA5nR
.

It would be better to select language in options :-(

At some point we'll add the option to select the language in the options, but you'll still always have to load the language files separately.

Let me know when the option feature is sorted, Ta!

For those using webpack there is solution using require function:

<html lang="cs">
const langMap = {
    cs: "cs_CZ",
    en: "en_US",
};

if (document.documentElement.lang in langMap) {
    require("bootstrap-select/js/i18n/defaults-" + langMap[document.documentElement.lang]);
} else {
    console.error("Unknown language " + document.documentElement.lang);
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ddinchev picture ddinchev  Â·  3Comments

james-yun picture james-yun  Â·  3Comments

EmilMoe picture EmilMoe  Â·  4Comments

didip picture didip  Â·  4Comments

AndreasPresthammer picture AndreasPresthammer  Â·  3Comments