Skip to content

Commit

Permalink
Merge pull request #218 from Yelinz/fix-readme
Browse files Browse the repository at this point in the history
Add README localization example
  • Loading branch information
MelSumner authored Jun 17, 2019
2 parents fcb9ba1 + 3426c18 commit 231f89b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ If you don't want to show an input field, you can use the `pikaday-inputless` co

Localizing the datepicker is possible in two steps. To localize the output of the datepicker, this is the formatted string visible in the input field, you simply include all the locales by following the [ember-cli-moment-shim instructions](https://github.com/jasonmit/ember-cli-moment-shim#cherry-pick-locales-optimal) and include the following in your `ember-cli-build.js`

```js
app.import('node_modules/moment/locale/de.js');
```

To localize the datepicker itself, this is the popup you see after clicking the input, a little more work is necessary. The prefered way to do this is writting a custom initializer to inject a localized `i18n` object into the datepicker component. Naturally you can use your own localized strings instead of the ones provided by Moment.js.

```js
Expand All @@ -187,7 +191,7 @@ import moment from 'moment';
export default {
name: 'setup-pikaday-i18n',
initialize: function(application) {
var i18n = EmberObject.extend({
let i18n = EmberObject.extend({
previousMonth: 'Vorheriger Monat',
nextMonth: 'Nächster Monat',
months: moment.localeData()._months,
Expand Down

0 comments on commit 231f89b

Please sign in to comment.