ember-cli-bootstrap-datepicker icon indicating copy to clipboard operation
ember-cli-bootstrap-datepicker copied to clipboard

Ability to set language on App or controller

Open broerse opened this issue 10 years ago • 3 comments

I don't think setting language="**" in the template for every datepicker is a good thing. Can we overwrite the language setting on App level or in a controller. Maybe use it with a queryparam. Perhaps this functionality is already in but undocumented?

broerse avatar Feb 19 '15 16:02 broerse

This is a pretty nice idea! :+1: I didn't have more than one datepicker on the template before, but could imagine that it would be nice to configure language on the app level.

soulim avatar Feb 20 '15 09:02 soulim

You can set default language and format for App in custom initializer, e.g.

// app/initializers/bootstrap-datepicker.js
export function initialize() {
  $.fn.datepicker.defaults.format = 'dd.mm.yyyy';
  $.fn.datepicker.defaults.language = 'de';
}

export default {
  name: 'bootstrap-datepicker',
  initialize: initialize
};

@soulim If you are OK with this approach for setting global defaults, I can open a PR adding this to documentation...

jesenko avatar May 15 '15 08:05 jesenko

@jesenko I like it :+1:

broerse avatar May 15 '15 13:05 broerse