c-3po


This project was formely named c-3po and later on renamed to ttag. Some of the talks, presentations, and documentation may still reference it by the old name. All new features will be applied to ttag package, the old c-3po packages will be supported only with bugfixes. Follow this simple migration guide

Please refer to the new doc https://ttag.js.org

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

Key features

Live example https://jsfiddle.net/0atw0hgh/

Tools:

The whole solution consists of 2 parts:

  1. ttag library - https://github.com/ttag-org/ttag
  2. ttag babel plugin - https://github.com/ttag/babel-plugin-ttag

How it looks like in the code:

Here is a usage of some ttag functions:

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

// simple string literals
const hello = t`Hello ttag`;

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

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

The ttag library aims to provide the most natural and reliable way to translate strings in JavaScript sources. It provides some helper functions (tags) for making JavaScript templates as translatable with all their shiny features like string interpolation, multiline etc.

Tutorials

Slides from talks

Talks

results matching ""

    No results matching ""