Template & Helpers

with handlebars

Basic handlebars helper

Handlebars.registerHelper('t', function(i18n_key) {
 
var result = i18n.t(i18n_key);
 
 
return new Handlebars.SafeString(result);
});

Usage in template
span {{t "my.key" }}

Extended handlebars helper

Handlebars.registerHelper('tr', function(context, options) { 
   
var opts = i18n.functions.extend(options.hash, context);
   
if (options.fn) opts.defaultValue = options.fn(context);
 
   
var result = i18n.t(opts.key, opts);
 
   
return new Handlebars.SafeString(result);
});

Usage in template
{{#tr this key="trans.sample.handlebarsExtended" add="from helper" }}
h6
Some Text
p some paragraph
with variable __add__ __addFromContext__
{{/tr}}

the passed in options from helper will be merged with the one of the context (this)

angular directive

Usage with angular.js

archer96 provides a solution to use i18next within angular.

for futher detail have a look at:

JQuery UI

JQuery UI - Button & Dialog

jlgrall provides a solution to use i18next data-attribute in combination with JQuery UI.

for futher detail have a look at: