Closed nirmalbaldaniya-dream closed 6 years ago
I found the solution. It has been fixed by {{data.intl.messages.placeholder}}
Can you explain the full process of Handlebars Intl integration with express-handlebars? how can I registre the helpers in the main app.js? how the helpers can be used in my templates
Ok, I got the answer by myself
For those who want to use Handlebars Intl from https://formatjs.io/handlebars/
The code is as follows:
// app.js
import exphbs from 'express-handlebars'
import HandlebarsIntl from 'handlebars-intl'
const hbs = exphbs.create()
HandlebarsIntl.registerWith(hbs.handlebars)
app.set('view engine', 'handlebars')
app.engine('handlebars', hbs.engine)
/*
... your express code
*/
// template.handlebars using the formatNumber helper from Handlebars Intl
{{formatNumber 1000 style="currency" currency="USD"}}
Hi eric, I want to integrate localization support in my app. So I want to know that how can we use "handlebars Intl" in this?