ttag

ttag

  • Docs
  • Blog
  • Github
ttag logo

ttagModern javascript i18n localization library based on ES6 tagged templates

Docs
Demo
Github

Usability

Just tag your strings to make them translatable. Use simple ttag-cli tool for translations extraction

Integration

Can be easily integrated with almost any workflow as it uses babel-plugin for strings extraction. Can be easily used with the typescript.

Performance

Allows you to place translations in to the sources on a build step

Based on GNU gettext

Gettext is a simple localization format with the rich ecosystem. Ttag has support for plurals, contexts, translator comments and much more.

ttag library

Simple use case:

import { t } from "ttag";

t`This string will be translated`;

Plurals:

import { ngettext, msgid } from "ttag";

ngettext(msgid`${n} banana`, `${n} bananas`, n);

Contexts:

import { c } from "ttag";

c('email').t`this text will be in email context`;

JSX:

import { jt } from "ttag";

jt`can use ${<JSXElement/>} inside the translations`;

ttag cli

Command line utility that is used for translations extraction and different .po files manipulations. Works with js, jsx, ts, tsx files out of the box.

Simple translations extraction to .po file:

ttag extract index.js

Update .po file with new translations:

ttag update out.po index.js

Create a new file with all strings replaced with translations from .po file:

ttag replace out.po index.js index-translated.js

Getting started

Follow this reference to get started quick

Who's Using This?

This project is used by all these people

prom.uabigl.uazakupki.prom.uakabanchik.uametabase.comremotehour.com
More ttag Users
ttag
Docs
Quick Startttag APIbabel-plugin-ttag API
Community
User ShowcaseStack OverflowTwitter
More
BlogGitHubStar
Copyright © 2024 ttag