@savvagent/tiny-i18next
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

@savvagent/tiny-i18next

This is a tiny and simple class for i18n translations. It supports placeholders and various plurals. It requires a modern browser or node 16.x or greater

Installation

Use npm, pnpm or yarn to install it.

pnpm add @savvagent/tiny-i18next

Use

import I18next from '@savvagent/tiny-i18next';
const enTranslations = {
  "cancel": "Cancel",
  "checkout": "Checkout",
  "modal_body": "This is the modal body",
  "open": "Open",
  "title": "Find"
}

const t = new I18next(enTranslations)

const t = new I18next({ name: "George" });
const userName = t('name') // George

See src/test/I18next.spec.ts for other examples

Package Sidebar

Install

npm i @savvagent/tiny-i18next

Weekly Downloads

3

Version

2.1.1

License

MIT

Unpacked Size

17 kB

Total Files

11

Last publish

Collaborators

  • robhicks