How to localize (i18n) moment.js within meteor.js?

user3573583

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

stringparser

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')

modify package.js

And there you go!

proof

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I localize my Meteor JS App?

How to use Vue i18n translation in .js file?

How to support i18n with kotlin js

How to restart Meteor server from within Meteor.js

How to localize currency lNuxtJS i18n

How to pass parameters to Vue.js i18n <i18n-t> tag

How to use setLocale within i18n-js?

Display a component within an i18n text in Vue.js

Sails.js: how to use i18n function in assets/js/files.js

Moment.js on meteor, Problems with Timezone

How to load i18n Property file using jQuery.i18n.properties.js + Spring 3 mvc

Nuxt/Vue js - How do I synchronize path field to an i18n variable in router. I did a try but can't get to i18n

How to extend moment js?

How to make i18n with Handlebars.js (mustache templates)?

Vue.js vuetify i18n : How to translate dynamically the Toolbar items?

How can get a non-trivial i18n translation to work using Sails.js?

Vue.js how to get current locale in i18n language package

How do I import moment.js?

I18n::InvalidLocaleData: I18n gem has issues in js export

Meteor JS: How should I bind events to the window in Meteor?

How do I update translated text when changing a language in a Vue.js app with i18n and Pinia?

node.js i18n: Use __ or import?

Vue.js: loop on <i18n> tag

I18N change language in Next.JS

How to format date in moment js

How to "pull out" styled HTML tags from I18N properties files with Makara module for Express and Kraken.js?

Storing Node.JS files Within a Meteor.JS Project

How i get days accurately in Moment.js

How can I transfer the moment.js breakpoints into a php formular?