@tannin/compat
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@tannin/compat

A Jed drop-in replacement shim for Tannin.

Installation

Using npm as a package manager:

npm install @tannin/compat

Otherwise, download a pre-built copy from unpkg:

https://unpkg.com/@tannin/compat/dist/compat.min.js

Usage

Construct a new instance with the same options supported by Jed.

See: https://messageformat.github.io/Jed/

import Jed from '@tannin/compat';

const i18n = new Jed( {
	locale_data: {
		the_domain: {
			'': {
				domain: 'the_domain',
				lang: 'en',
				plural_forms: 'nplurals=2; plural=(n != 1);',
			},
			example: [ 'singular translation', 'plural translation' ],
		},
	},
	domain: 'the_domain',
} );

i18n.translate( 'example' ).fetch();
// ⇒ 'singular translation'

License

Copyright 2019-2020 Andrew Duthie

Released under the MIT License.

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @tannin/compat

    Weekly Downloads

    114

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    44.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • aduth