Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I use the datePicker documented here.

However, no direct option allows to change the language, English by default.

I find a the documentation of the widget provided without angular directive, and it provides a nice way to achieve it:

http://bootstrap-datepicker.readthedocs.org/en/latest/i18n.html

Is there an easy way, avoiding to tweak the original directive's source code, to change it?

share|improve this question

2 Answers 2

up vote 48 down vote accepted

If you are using the DatePicker form angular-ui simply add the localized js file in the header of your page. An example would be :

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script>
<script src="http://code.angularjs.org/1.0.8/i18n/angular-locale_fr-fr.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>

You can see a working plunker here

share|improve this answer
9  
This doesn't translate the action buttons text when using the popup. To translate it, you must also configure the datepickerPopupConfig global objetct : plnkr.co/edit/g5uxqcJkhqbQRKmLI2Zj?p=preview – Mat May 11 '14 at 13:05
2  
When using bower, bower install angular-i18n – fracz Oct 4 '14 at 18:33

First, you have to load your locales (get them here) script after angular in index.html:

 <script src="angular.js"></script>
 <script src="angular-locale_de-de.js"></script>

After that, the days and months are localised but you need to translate the buttons by yourself adding parameters inside the datepicker input tag:

<input type="text" class="form-control" datepicker-popup="dd.MM.yyyy"
ng-model="dt" is-open="opened" min-date="minDate" max-date="'2042-04-02'"
datepicker-options="dateOptions" date-disabled="disabled(date, mode)" 
ng-required="true" 
current-text="Tonight" clear-text="Reset" close-text="Exit" />
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.