Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use i18n #813

Closed
valix85 opened this issue Nov 26, 2014 · 13 comments
Closed

how to use i18n #813

valix85 opened this issue Nov 26, 2014 · 13 comments

Comments

@valix85
Copy link

valix85 commented Nov 26, 2014

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

@truckingsim
Copy link
Contributor

@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.

@valix85
Copy link
Author

valix85 commented Dec 2, 2014

ok, it's work!
thank you very much

@ochafloquet
Copy link

LIKE THIS

<script> $(document).ready(function(){ $('#combogrados').selectpicker({ language: 'ES' }); }); </script>

@ochafloquet
Copy link

Only put the language.js and it works

@dfarm3r
Copy link

dfarm3r commented Jun 28, 2017

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?

@caseyjhol
Copy link
Member

Simply load the language file after bootstrap-select.

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/bootstrap-select.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/i18n/defaults-de_DE.min.js"></script>

@dfarm3r
Copy link

dfarm3r commented Jun 29, 2017 via email

@dfarm3r
Copy link

dfarm3r commented Jun 29, 2017 via email

@caseyjhol
Copy link
Member

@aolszak
Copy link

aolszak commented Feb 29, 2020

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

@caseyjhol
Copy link
Member

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.

@NeilAllen
Copy link

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

@adaamz
Copy link

adaamz commented Jun 16, 2020

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants