node.js - nodejs + i18n: cannot access translation from ejs template -


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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -