Alex Turpin
Alex Turpin

Reputation: 47776

Load Globalize cultures with Node.js?

I'm using jQuery Globalize with Node.js. They have a package.json file so I can simply use it as a module and require it. However, it doesn't load all cultures by default. I was wondering what the proper way to load a culture would be? I could go and do something like

require('./node_modules/globalize/lib/cultures/globalize.culture.es-US.js')

and load the file directly, but that doesn't seem too elegant. Is there a "proper" way to do this?

Upvotes: 1

Views: 2186

Answers (2)

Ben
Ben

Reputation: 197

If you'd like to support all cultures, with a single require:

require("./node_modules/globalize/lib/cultures/globalize.cultures.js");

should do the trick.

Upvotes: 1

mikl
mikl

Reputation: 24267

You should use the Globalize NPM package if you're not doing that already.

It does not seem that there is a proper way to load the cultures included, however. I think the intended usage is to use Grunt to package the cultures you need along with the Globalize code itself.

Upvotes: 0

Related Questions