Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Add i18n to Datepicker #777

Closed
rsvalerio opened this issue Aug 7, 2013 · 11 comments
Closed

Add i18n to Datepicker #777

rsvalerio opened this issue Aug 7, 2013 · 11 comments

Comments

@rsvalerio
Copy link

Or, in the meantime, is it possible to translate?

@bekos
Copy link
Contributor

bekos commented Aug 7, 2013

You have to use a locale from AnularJS, since labels are created with the datefilter.

Example: http://plnkr.co/edit/7Fi5rO839elOeJwi5vH2?p=preview

@MattiJarvinen-BA
Copy link

@bekos Yes, but I guess he means clear, today and close buttons.

@bekos
Copy link
Contributor

bekos commented Aug 7, 2013

OK I see. If you talk about the popup datepicker, the way to translate the buttons in the bar, is to override the template. I suppose we could add some config for these labels for the next release. What about a PR? :-)

@rsvalerio
Copy link
Author

OK I'll try :)

bekos added a commit to bekos/bootstrap that referenced this issue Sep 21, 2013
@bekos bekos closed this as completed in c6ba8d7 Sep 21, 2013
@ThCC
Copy link

ThCC commented Sep 27, 2013

@bekos There is no other way to translate the datepicker? The only way is modifying the index.html?
In my application I identify the language of the user when it performs login. That is, the index is already configured.

@bekos
Copy link
Contributor

bekos commented Sep 30, 2013

@ThCC The real problem is that you cannot change your $locale during runtime, or at least I don't know of a way to do this. Even if you solve the problem with the datepicker, you will still have problem in every other filter that is locale dependent, like currency.

I think it is better to ask a more general question in the AngularJS issues.

@ThCC
Copy link

ThCC commented Sep 30, 2013

Thanks for answering @bekos, I'll see what I can do.

@bekos
Copy link
Contributor

bekos commented Sep 30, 2013

You can check this project http://pascalprecht.github.io/angular-translate/ to see if it helps.
In case you find a solution please get back to us :-)

@ThCC
Copy link

ThCC commented Sep 30, 2013

Again thank you. I'm using this component in the project, but I'll see if I can use it in conjunction with the datepicker. If I succeed I will return to tell you ;)

@vladei
Copy link

vladei commented Oct 7, 2015

@ThCC can you tell us if the angular-translate works in conjunction with the datepicker?

@rbaarsma
Copy link

rbaarsma commented Dec 4, 2015

It works for the names of days and months, but not the texts Today / Clear / Done

Anyone looking for a quickfix, you can override the config:

var app = angular.module('myapp', ['ui.bootstrap']);
    app.constant('uibDatepickerPopupConfig', {
        datepickerPopup: 'yyyy-MM-dd',
        datepickerPopupTemplateUrl: 'template/datepicker/popup.html',
        datepickerTemplateUrl: 'template/datepicker/datepicker.html',
        html5Types: {
            date: 'yyyy-MM-dd',
            'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',
            'month': 'yyyy-MM'
        },
        currentText: 'Vandaag',
        clearText: 'Wissen',
        closeText: 'Klaar',
        closeOnDateSelection: true,
        appendToBody: false,
        showButtonBar: true,
        onOpenFocus: true
    });

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

No branches or pull requests

6 participants