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

simple-translate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-translate

Really simple and dumb possibility to use a translate helper in your project.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Dead Simple translations

This module provides you an easy way to translate strings. Just pass in an object to .create with all your locales + translations and you will get a function to translate strings.

Installation

npm install simple-translate

Usage

var Translate = require("this-translate-module");
var translations = {
    "en": {
        "hello": "Hello!",
        "hello_name": "Hello {{name}}!"
    },
    "de": {
        "hello": "Hallo!",
        "hello_name": "Hallo {{name}}!"
    }
}
# default locale is "en"
var translate = Translate.create(translations);
translate("hello"); // "Hello!"
translate("hello_name", {name: "Horst"}); // "Hello Horst!"

# If you want any other locale you can simply set the "locale" property
translations.locale = "de";
var translate = Translate.create(translations);
translate("hello"); // "Hello!"
translate("hello_name", {name: "Horst"}); // "Hello Horst!"

Build Status

FAQs

Package last updated on 01 Feb 2015

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