New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

handlebars-tr

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-tr

Simple helper to render translated template

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

#handlebars-tr

A simple helper to translate strings in handlebars.

##Usage

var Handlebars = require('handlebars');
//var handlebarsTr = require('handlebars-tr')(Handlebars, '__language', '***');
var handlebarsTr = require('handlebars-tr')(); //This line is equivalent to the previous one

var template = Handlebars.compile('{{tr "Test"}}');
var data = {
  __language: {
    Test: 'TestTranslation{{magic}}'
  }
  magic: 'Magic'
};
console.log(template(data));

This helper actually compile the strings in __language as handlebars template, passing all the data available to the root context.

If a string is not found in __language, the path will be printed surrounded by ***: ***Test***

##License MIT

Keywords

translate

FAQs

Package last updated on 03 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts