Skip to content

Latest commit

 

History

History
76 lines (48 loc) · 1.21 KB

.verbrc.md

File metadata and controls

76 lines (48 loc) · 1.21 KB

{{{%= shortname(name) %}}} {%= badge('fury') %}

{%= description %}

Install

{%= include("install-npm") %}

Register the helper

var Handlebars = require('handlebars');
var helper = require('handlebars-helper-i18n');

Handlebars.registerHelper('i18n', helper.i18n);

Register the helper with Assemble

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.

Usage

var context = {
  language: 'en',
  en: {key: 'value'},
  fr: {key: 'valeur'}
};

Handlebars.compile('{{i18n "key" language="fr"}}');
console.log(template(context));
//=> 'valeur'

Author

Laurent Goderre

License

{%= copyright() %} {%= license() %}


{%= include("footer") %}