jeresig / i18n-node-2

Lightweight simple translation module for node.js / express.js with dynamic json storage. Uses common __('...') syntax in app and templates.
MIT License
507 stars 79 forks source link

Templating i18n with dot.js #70

Closed eltorres77 closed 9 years ago

eltorres77 commented 9 years ago

I'm trying to make it work with dotjs like the swig example

<h1>{{ __("Welcome to:") }}</h1>

Dot.js uses {{=it.object}} for rendering variables, so {{=it.__("Welcome to:") }} or {{__("Welcome to:") }} does not work. Should I pass the entire i18n object to the template in express and render like this:?

<h1>{{ =it.i18n.welcome_message }}</h1>
gjuchault commented 9 years ago

I don't think you can use functions in dotjs. You may use the internal locale (i18n.locale.key) but you won't be able to use advanced features.