by ttag-org

ttag-org / ttag

:orange_book: simple approach for javascript localization

216 Stars 20 Forks Last release: over 3 years ago (v0.5.1) MIT License 451 Commits 62 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


travis codecov downloads


:warning: This project was previously named

. Some of the talks, presentations, and documentation may reference it with both names.

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

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 = tHello ${name};

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


npm install --save ttag


You may also need to install ttag-cli for

files manipulation.

ttag cli -

npm install --save-dev ttag-cli

Usage from CDN

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

Useful links


Slides from talks


We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.