Usability
Usability
Just tag your strings to make them translatable. Use simple ttag-cli tool for translations extraction
Integration
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
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.
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`;
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
Getting started