adopted-ember-addons / ember-pikaday

A datepicker component for Ember CLI projects.
MIT License
158 stars 169 forks source link

Localization #1

Closed jpsala closed 10 years ago

jpsala commented 10 years ago

Hi, I dont't know if this is the right place to ask, if it is not, please tell me. The question is: how can I change the locale?

Edit: I changed this line: //file = /node_modules/ember-pikaday/index.js app.import('bower_components/momentjs/moment.js'); for theese: app.import('bower_components/momentjs/min/moment.min.js'); app.import('bower_components/momentjs/locale/es.js'); And now it's working fine, thanks for this component, it's great.

stravid commented 10 years ago

Thank you @jpsala for opening this issue, this is definitely the right place to ask this.

You should not modify files within the ./node_modules directory, this will make upgrading packages a nightmare! Adding app.import('bower_components/momentjs/locale/es.js'); to Brocfile.js should also work without the downsides.

Am I correct that adding the Moment.js locale file only changes the output of the datepicker? The datepicker itself will still be in English correct?

If that's the case I have to think about a way to localize the datepicker itself.

kristianmandrup commented 10 years ago

Please add this to usage instructions ;)

stravid commented 10 years ago

@jpsala @kristianmandrup I have a question regarding API design and setting the locale: Should that happen in an initializer that injects the locale into the component or is it cleaner to extend the component and overwrite the locale there.

What do you guys consider the best solution?

stravid commented 10 years ago

See the new release and instructions in the readme!

jpsala commented 10 years ago

Thanks! I'll see them

On Sat, Sep 13, 2014 at 9:55 AM, David Strauß notifications@github.com wrote:

See the new release and instructions in the readme!

Reply to this email directly or view it on GitHub https://github.com/edgycircle/ember-pikaday/issues/1#issuecomment-55493169 .

jpsala commented 10 years ago

Hello David, I tried your instructions, the language is ok, but I have this issue: * in my Brocfile: app.import('bower_components/momentjs/min/moment.min.js'); app.import('bower_components/momentjs/locale/es.js'); app.import('bower_components/pikaday/pikaday.js'); app.import('bower_components/pikaday/css/pikaday.css'); ** in my template i have this: {{pikaday-input value='13/12/2013' valueFormat='DD/MM/YYYY' inputFormat='DD/MM/YYYY'}} ** and I get this: 12.01.2014 ** I I try this too: {{pikaday-input value='13/12/2013'}} **\ and the result is the same, do you have any advice? thanks

stravid commented 10 years ago

value has to be a JavaScript date object and there is only a format attribute, no valueFormat and inputFormat.

jpsala commented 10 years ago

Thanks! that worked