You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Express + Handlebars with the library.
When I enable objectNotation, the project crashes. With object notation disabled, regular key/value pairs work just fine.
Relevant code:
i18n.configure({locales: availableLocales,defaultLocale: 'en',directory: __dirname+'/locales',cookie: 'locale',objectNotation: true});app.use(favicon(path.join(__dirname,'public','images','favicon.png')));// TODO: ver por que no funcionaapp.set('views',path.join(__dirname,'views'));app.set('view engine','hbs');app.engine('hbs',hbs.__express);app.use(cookieParser());app.use(i18n.init);app.use(logger('dev'));app.use(express.json());app.use(express.urlencoded({extended: false}));hbs.registerHelper('__',function(){returni18n.__.apply(this,arguments);});hbs.registerHelper('__n',function(){returni18n.__n.apply(this,arguments);});app.use(express.static(path.join(__dirname,'public')));app.use('/',indexRouter);
TypeError: /Users/mrg/WebstormProjects/myproj/views/error.hbs: Cannot read property 'indexOf' of undefined
at translate (/Users/mrg/WebstormProjects/myproj/node_modules/i18n/i18n.js:862:34)
at Object.i18nTranslate (/Users/mrg/WebstormProjects/myproj/node_modules/i18n/i18n.js:220:13)
at Object.<anonymous> (/Users/mrg/WebstormProjects/myproj/app.js:33:20)
at Object.eval [as main] (eval at createFunctionContext (/Users/mrg/WebstormProjects/myproj/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:6:66)
at main (/Users/mrg/WebstormProjects/myproj/node_modules/handlebars/dist/cjs/handlebars/runtime.js:173:32)
at ret (/Users/mrg/WebstormProjects/myproj/node_modules/handlebars/dist/cjs/handlebars/runtime.js:176:12)
at ret (/Users/mrg/WebstormProjects/myproj/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:525:21)
at /Users/mrg/WebstormProjects/myproj/node_modules/hbs/lib/hbs.js:87:17
at /Users/mrg/WebstormProjects/myproj/node_modules/hbs/lib/hbs.js:69:11
at Object.done (/Users/mrg/WebstormProjects/myproj/node_modules/hbs/lib/async.js:74:20)
The text was updated successfully, but these errors were encountered:
Just encountered the same issue today in 2021. You have to turn that feature on by specifying the field "objectNotation" to be true in the configuration
I'm using Express + Handlebars with the library.
When I enable objectNotation, the project crashes. With object notation disabled, regular key/value pairs work just fine.
Relevant code:
Route
Template
Locale
Error message:
The text was updated successfully, but these errors were encountered: