Skip to content
New issue

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

Setting the locale of Handlebars Intl using Express #89

Open
ghost opened this issue Mar 28, 2018 · 4 comments
Open

Setting the locale of Handlebars Intl using Express #89

ghost opened this issue Mar 28, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 28, 2018

I'm using express, express-handlebars and handlebars-intl and I would like to change the default "en" locale to another (like "it").

I read that this plugin uses Intl.DateTimeFormat to formats. In this specific case how can I edit things like locale, timezone, date formats, etc..

    const hbs = exphbs.create({ extname: '.hbs' });
    app.engine(hbs.extname, hbs.engine);
    HandlebarsIntl.registerWith(hbs.handlebars); // Handlebars Intl Plugin
    app.set('view engine', hbs.extname);
    app.set('views', path.join(__dirname, './views/pages'));

Final goal:

Correctly renders with Handlebars this datetime {{formatDate time}} using my specified locale

@ghost
Copy link
Author

ghost commented Mar 28, 2018

Just tried:

global.HandlebarsIntl = HandlebarsIntl;
require('handlebars-intl/dist/locale-data/it');

or even:

HandlebarsIntl.__addLocaleData({locale: "it"})

No errors but does not works, what am I missing? :\

@unValerio
Copy link

same issue

2 similar comments
@szappala
Copy link

szappala commented May 8, 2019

same issue

@igordeoliveirasa
Copy link

same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants