We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
environment nodejs 8.0 express 4 i18n-node 3.0 give the error "Cannot read property 'abc' of undefined" when define the text in .hbs template file
in index.js (middleware) `var i18n_module = require('i18n-nodejs'),//2018-4-22 JH .... // 2018-4-22 JH START var config = { "lang": "zh-cn", "langFile": path.join(__dirname + "/../locales/locale.json")//relative path to index.js file of i18n-nodejs module } var i18n = new i18n_module(config.lang, config.langFile);
... module.exports = function(app, db, callback) { ... app.engine('hbs', hbs.express4({ handlebars: HandleBars, defaultLayout: path.join(__dirname, '../views/layout/main.hbs'), i18n: i18n,//2018-4-24 JH partialsDir: [path.join(__dirname + '/../views/partials/'), path.join(__dirname + '/../views/subviews/reports')] })); app.set('view engine', 'hbs'); hbsHelpers.register(hbs.handlebars); ...`
in template <h4 style="font-size: 24px; margin-top: 7px; font-weight: 300;color: #222;"> {{__ 'PrivacyPolicy'}} <a class="uk-modal-close uk-close no-ajaxy right" aria-label="Close"></a> </h4>
<h4 style="font-size: 24px; margin-top: 7px; font-weight: 300;color: #222;"> {{__ 'PrivacyPolicy'}} <a class="uk-modal-close uk-close no-ajaxy right" aria-label="Close"></a> </h4>
in .json locale file { "TruDesk i18n initialized.": { "ar": "مرحبا", "zh-cn": "TruDesk i18n 初始化成功." }, "PrivacyPolicy": { "zh-cn": "隐私政策", "en": "Privacy Policy" } }
{ "TruDesk i18n initialized.": { "ar": "مرحبا", "zh-cn": "TruDesk i18n 初始化成功." }, "PrivacyPolicy": { "zh-cn": "隐私政策", "en": "Privacy Policy" } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
environment
nodejs 8.0
express 4
i18n-node 3.0
give the error "Cannot read property 'abc' of undefined" when define the text in .hbs template file
in index.js (middleware)
`var i18n_module = require('i18n-nodejs'),//2018-4-22 JH
....
// 2018-4-22 JH START
var config = {
"lang": "zh-cn",
"langFile": path.join(__dirname + "/../locales/locale.json")//relative path to index.js file of i18n-nodejs module
}
var i18n = new i18n_module(config.lang, config.langFile);
...
module.exports = function(app, db, callback) {
...
app.engine('hbs', hbs.express4({
handlebars: HandleBars,
defaultLayout: path.join(__dirname, '../views/layout/main.hbs'),
i18n: i18n,//2018-4-24 JH
partialsDir: [path.join(__dirname + '/../views/partials/'), path.join(__dirname + '/../views/subviews/reports')]
}));
app.set('view engine', 'hbs');
hbsHelpers.register(hbs.handlebars);
...`
in template
<h4 style="font-size: 24px; margin-top: 7px; font-weight: 300;color: #222;"> {{__ 'PrivacyPolicy'}} <a class="uk-modal-close uk-close no-ajaxy right" aria-label="Close"></a> </h4>
in .json locale file
{ "TruDesk i18n initialized.": { "ar": "مرحبا", "zh-cn": "TruDesk i18n 初始化成功." }, "PrivacyPolicy": { "zh-cn": "隐私政策", "en": "Privacy Policy" } }
The text was updated successfully, but these errors were encountered: