1.8.7 • Published 1 year ago

ttag v1.8.7

Weekly downloads
8,324
License
MIT
Repository
github
Last release
1 year ago

Stand With Ukraine

ttag

Modern javascript i18n localization library based on ES6 tagged templates and the good old GNU gettext

travis codecov downloads

NPM


Key features

  • Uses ES6 template literals for string formatting (no need for sprintf).
  • Contexts support
  • It can precompile translations on a build step.
  • Plurals support ngettext.
  • It can be integrated in any build tool that works with babel.
  • Has a builtin validation for translated strings format.
  • It can use any default locale in sources (not only English).
  • Handles React (jsx) translations.
  • Can be easily integrated with Create React App. CRA doc

Usage example

import { t, ngettext, msgid } from 'ttag';

// formatted strings
const name = 'Mike';
const helloMike = t`Hello ${name}`;

// plurals (works for en locale out of the box)
const n = 5;
const msg = ngettext(msgid`${n} task left`, `${n} tasks left`, n);

Installation

npm install --save ttag

CLI

You may also need to install ttag-cli for po files manipulation.

ttag cli - https://github.com/ttag-org/ttag-cli

npm install --save-dev ttag-cli

Usage from CDN

https://unpkg.com/ttag/dist/ttag.min.js

This project is designed to work in pair with babel-plugin-ttag.
But you can also play with it without transpilation.

Support

Give a ⭐️ if this project helped you!

Useful links

Slides from talks

Talks

License

This project is licensed under the MIT license.

1.8.7

1 year ago

1.8.6

1 year ago

1.8.5

1 year ago

1.8.4

2 years ago

1.8.3

2 years ago

1.8.2

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.7.28

2 years ago

1.7.29

2 years ago

1.7.26

2 years ago

1.7.27

2 years ago

1.7.25

2 years ago

1.7.24

4 years ago

1.7.23

5 years ago

1.7.22

5 years ago

1.7.21

6 years ago

1.7.20

6 years ago

1.7.19

6 years ago

1.7.18

6 years ago

1.7.17

6 years ago

1.7.16

6 years ago

1.7.15

6 years ago

1.7.14

6 years ago

1.7.13

6 years ago

1.7.12

6 years ago

1.7.9

6 years ago

1.7.8

6 years ago

1.7.7

6 years ago

1.7.6

6 years ago

1.7.5

6 years ago

1.7.4

6 years ago

1.7.3

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.1

7 years ago

1.2.1

7 years ago

1.2.1-0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.1.0-0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.1-1

7 years ago

1.0.1-0

7 years ago

1.0.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago