How can moment.js used within a meteor.js app be told to use another language than English? moment.js (installed as an mrt package) works fine with the default English language.
Using the demo calls from the moment.js docs at http://momentjs.com/docs/#/i18n/changing-language/ always produces 'en'. I noticed there is a German language file for moment in meteor_project/packages/moment/lib/moment/lang/de.js that doesn't seem to be used though?
To specify: within a template helper I tried: moment.lang('de'); return moment.lang() //will result to 'en'
and the other options mentioned here: Format a date from inside a Handlebars Template in Meteor
If you installed moment
as
mrt add moment
Then you already got the languages, but you have to include them manually. Find them at packages\moment\lib\lang
. To include them, go to the package.js
file and add the language of your choice after all the other files.
api.add_files('lib/moment/lang/de.js', 'client')
And there you go!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments