i'm new nodejs , include i18n module project i'm not able access translation ejs template
node index.js
var app = express(); i18n = require('i18n'); var cookieparser = require('cookie-parser'); var server = require('http').createserver(app); i18n.configure({ locales: ['en', 'fr'], defaultlocale: 'en', directory: __dirname + '/locales', cookiename: 'locale' }); app.use(cookieparser()); app.use(i18n.init); app.get('/', function(req, res) { res.render('index'); })
en.json
{ "header": { "access": { "login": "login" } } }
ejs template
<%= __('header.access.login')%>
ejs prints variable name(header.access.login) instead of value(login)
can ?
Comments
Post a Comment