New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simplest-i18n

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplest-i18n

The Simplest Universal i18n Solution

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47
decreased by-11.32%
Maintainers
1
Weekly downloads
 
Created
Source

The Simplest Universal i18n Solution

npm version npm download JavaScript Style Guide

$ Features

  • Support browsers and Node.js
  • No dependencies (source code < 0.5KB)
  • Does not rely on any framework (React / Vue / Angular / ...) or any bundler (Webpack / Parcel / Rollup / ...)
  • Extremely simple and flexible

$ Installation

⊙ NPM

npm i simplest-i18n -S

⊙ CDN

<script src="//unpkg.com/simplest-i18n"></script>

$ Usage

import i18n from 'simplest-i18n'

const t = i18n({
  locale: navigator.language.toLowerCase(), // e.g. here yields 'en-us'
  locales: [
    // it is recommended that set your mother tongue as the first locale (e.g. Simplified Chinese for me)
    'zh-cn',
    'en-us',
    'ja'
  ]
})

console.log(
  t(
    '你好',
    'Hello',
    'こんにちは'
  )
) // outputs 'Hello'

There are code examples for React and Vue in examples/
Check it out and run it with the following directives:

>_ git clone https://github.com/kenberkeley/simplest-i18n
>_ npm i
>_ npm run react (or npm run vue)

Keywords

FAQs

Package last updated on 15 Jan 2018

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