@darkwolf/localizer.mjs

1.0.4 • Public • Published

Localizer

Install

ECMAScript (Node.js v12.x LTS or higher)

npm i --save @darkwolf/localizer.mjs

CommonJS (Node.js v10.x LTS or higher)

npm i --save @darkwolf/localizer.cjs

Using

// ECMAScript
import Localizer, { Language } from '@darkwolf/localizer.mjs'

// CommonJS
const Localizer = require('@darkwolf/localizer.cjs')
const { Language } = Localizer

const localizer = new Localizer({
  [Language.EN]: {
    ave: {
      darkwolf: 'Ave, Darkwolf!',
      username: 'Ave, @{username}'
    },
    wfc: 'WFC: {wallet.balance}'
  },
  [Language.RU]: {
    ave: {
      darkwolf: 'Аве, Дарквольф!'
    }
  }
}, {language: Language.RU})
localizer.localize('ave.darkwolf') // => 'Аве, Дарквольф!'
localizer.localize('ave.username', {
  props: {
    username: 'PavelWolfDark'
  }
}) // => 'Ave, @PavelWolfDark!'
localizer.localize('wfc', {
  props: {
    wallet: {
      balance: '1.00000001'
    }
  }
}) // => 'WFC: 1.00000001'

API Documentation

Contact Me

GitHub: @PavelWolfDark

Telegram: @PavelWolfDark

Email: PavelWolfDark@gmail.com

Package Sidebar

Install

npm i @darkwolf/localizer.mjs

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

12.5 kB

Total Files

11

Last publish

Collaborators

  • pavelwolfdark