Socket
Socket
Sign inDemoInstall

js-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

js-translate

very simple i18n library for javascript


Version published
Weekly downloads
7
decreased by-46.15%
Maintainers
1
Weekly downloads
 
Created
Source

JS-TRANSLATE

Build Status

Very easy i18n library. Just load your data, and then start to translate.

  • supports wildcards
  • supports regional dialects with residing to global
  • several levels of warning

Usage

import { i18n } from 'js-translate';

// init current language and default language
const translator = i18n({ language: 'en', defaultLanguage: 'en' });
// fill dictionary
translator.add([{
    language: 'en',
    data: {
        'my string': 'Some translated stuff!',
        'string with {params}': '{params} is here!'
    }
}]);

// use
translator.translate('string with {params}', 'Date');
-> Date is here!

// change language
translator.useLanguage('ta');

You could specify several translators, with different parameters. If default wildcards isn't appropriate to you, then you could change it:

const translator = i18n({ language: 'en', startSeparator: '{{', endSeparator: '}}' });

And again, all instansiated translators don't share these settings.


© 2015 MIT

Keywords

FAQs

Package last updated on 09 Dec 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc