Monday, May 20, 2024
179
rated 0 times [  183] [ 4]  / answers: 1 / hits: 5173  / 10 Years ago, mon, april 28, 2014, 12:00:00

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


More From » internationalization

 Answers
2

If you installed moment as



mrt add moment



Then you already got the languages, but you have to include them manually. Find them at packagesmomentliblang. 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')



modify



And there you go!



proof


[#45706] Saturday, April 26, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shaynelandenb

Total Points: 293
Total Questions: 97
Total Answers: 94

Location: Monaco
Member since Fri, Sep 24, 2021
3 Years ago
;