formatjs / handlebars-intl

Handlebars helpers for internationalization.
http://formatjs.io/handlebars/
Other
265 stars 28 forks source link

bower package #71

Closed siddo420 closed 8 years ago

siddo420 commented 8 years ago

I cant find bower package.

Does that mean it can only be used on a Node.js server?

jasonmit commented 8 years ago

@siddo420 it works in the browser -- it's just not registered on bower. You can always pull it in over git if you choose to not use npm over bower.

bower install git@github.com:yahoo/handlebars-intl.git

siddo420 commented 8 years ago

Thanks. I installed it using

bower install --save https://github.com/yahoo/handlebars-intl.git

Can you give an example of how to use it in Node? I have patched Node.js, installed relevant modules etc. But, I am not sure how to use it now.

I wanted to use it for error messages initially. For example, I have directory structure like below:

templates/en-US/errors/error1.hbs
templates/en-US/errors/error2.hbs
templates/fr-FR/errors/error1.hbs
templates/fr-FR/errors/error2.hbs

What is the best way to use them in my Node.js code? Also, can it be easily used with ConsolidateJS?

jasonmit commented 8 years ago

The documentation on the website covers the instructions: http://formatjs.io/handlebars

Also, can it be easily used with ConsolidateJS?

Report back on your findings.

siddo420 commented 8 years ago

I had read that page already but it does not explain my particular case (I guess).

I couldn't easily use it with ConsolidateJS because I wanted to use pre-compiled handlebar templates. There is a way to get the handlebars object thru consolidate but it was throwing errors for some reason.

I managed to somehow make it work with lots of hacking :)