{%= description %}
{%= include("install-npm") %}
var Handlebars = require('handlebars');
var helper = require('handlebars-helper-i18n');
Handlebars.registerHelper('i18n', helper.i18n);
Assemble v0.6.x
var assemble = require('assemble');
var helper = require('assemble-handlebars-i18n');
assemble.helper('i18n', helper.i18n);
Assemble v0.4.x
In your project's Gruntfile:
assemble: {
options: {
helpers: ['handlebars-helper-i18n']
},
files: {...}
}
Also, be sure to add the helper to devDependencies
in package.json for Assemble to automatically register the helper.
var context = {
language: 'en',
en: {key: 'value'},
fr: {key: 'valeur'}
};
Handlebars.compile('{{i18n "key" language="fr"}}');
console.log(template(context));
//=> 'valeur'
Laurent Goderre
{%= copyright() %} {%= license() %}
{%= include("footer") %}