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

how to use for ejs template? #11

Closed marti1125 closed 11 years ago

marti1125 commented 11 years ago

exports.index = function(req, res){ res.render('index', { title: 'Welcome' , slides: req.i18n.__('slides') }); }; <h2><%= slides %></h2>

"express": "3.1.0"

I get this error 500 TypeError: Cannot call method '__' of undefined

mweibel commented 11 years ago

:+1:

jeresig commented 11 years ago

I believe you're still going to have to call i18n.expressBind() - are you doing that in your app?

marti1125 commented 11 years ago

why i see this error } has no method '' console.log( i18n.() );

gtrabanco commented 8 years ago

Why closed? It is not resolved.

gjuchault commented 8 years ago

It's closed because the solution was given : there was a missing i18n.expressBind() which must be called. See https://github.com/jeresig/i18n-node-2#using-with-expressjs for more informations