[](https://stand-with-ukraine.pp.ua)
npm install ttag-cli
> :warning: This project was previously named c-3po-cli.
> Some of the talks, presentations, and documentation _may_ reference it with both names.
Command line utility for ttag translation library.
Works out of the box with js, ts, jsx, tsx, mjs, cjs, vue, svelte, files.
bash
npm install ttag-cli
or global
npm install -g ttag-cli
`Usage example:
`
ttag extract some.js
`Commands description
$3
will extract translations to .pot file
#### Arguments:
-output --o result file with translations (.pot) (default: translations.pot)
-lang --l sets default lang (ISO format) (default: en)
-discover string overrides babel-plugi-ttag setting - https://ttag.js.org/docs/plugin-api.html#configdiscover. Can be used to discover ttag functions without explicit import. Only known ttag functions can be used as params (t, jt, ngettext, gettext, _)
-numberedExpressions boolean overrides babel-plugin-ttag setting - https://ttag.js.org/docs/plugin-api.html#confignumberedexpressions. Refer to the doc for the details.
-extractLocation string - 'full' | 'file' | 'never' - https://ttag.js.org/docs/plugin-api.html#configextractlocation. Is used to format location comments in the .po file.
-sortByMsgid boolean - The resulting output will be sorted alphabetically. https://ttag.js.org/docs/plugin-api.html#configsortbymsgid
-useProjectBabelrc boolean - Ttag cli will use projects babel config files. https://ttag.js.org/docs/plugin-api.html#useProjectBabelrcDescription
$3
will check if all translations are present in .po file
#### Arguments:
-lang --l sets default lang (ISO format) (default: en)
-skip let skip translation check
-discover string overrides babel-plugi-ttag setting - https://ttag.js.org/docs/plugin-api.html#configdiscover. Can be used to discover ttag functions without explicit import. Only known ttag functions can be used as params (t, jt, ngettext, gettext, _)
-numberedExpressions boolean overrides babel-plugin-ttag setting - https://ttag.js.org/docs/plugin-api.html#confignumberedexpressions. Refer to the doc for the details.
-extractLocation string - 'full' | 'file' | 'never' - https://ttag.js.org/docs/plugin-api.html#configextractlocation. Is used to format location comments in the .po file.
-sortByMsgid boolean - The resulting output will be sorted alphabetically. https://ttag.js.org/docs/plugin-api.html#configsortbymsgid
-useProjectBabelrc boolean - Ttag cli will use projects babel config files. https://ttag.js.org/docs/plugin-api.html#useProjectBabelrcDescription
$3
will merge two or more po(t) files together using first non-empty msgstr and header from left-most file
$3
will open interactive prompt to translate all msgids with empty msgstr in cli
#### Arguments:
-output --o result file with translations (.po) (default: translated.po)
$3
will display various pofile statistics(encoding, plurals, translated, fuzzyness)
$3
will filter pofile by entry attributes(fuzzy, obsolete, (un)translated)
#### Arguments:
-fuzzy --f result file with fuzzy messages (.po) (default: false)
-no-fuzzy --nf result file without fuzzy messages (.po) (default: false)
-translated --t result file with translations (.po) (default: false)
-not-translated --nt result file without translations (.po) (default: false)
-reference --r a regexp to match references against (default: )
#### Example:
ttag filter -nt small.po msgid "test"
msgstr ""
$3
will create an empty .po file with all necessary headers for the locale
#### Arguments:
-lang sets default locale (ISO format) (default: en)
-filename path to the .po file
$3
will update existing po file. Add/remove new translations
#### Arguments:
-lang sets default locale (ISO format) (default: en)
-pofile path to .po file with translations
-src path to source files/directories
-discover string overrides babel-plugi-ttag setting - https://ttag.js.org/docs/plugin-api.html#configdiscover. Can be used to discover ttag functions without explicit import. Only known ttag functions can be used as params (t, jt, ngettext, gettext, _)
-numberedExpressions boolean overrides babel-plugin-ttag setting - https://ttag.js.org/docs/plugin-api.html#confignumberedexpressions. Refer to the doc for the details.
-extractLocation string - 'full' | 'file' | 'never' - https://ttag.js.org/docs/plugin-api.html#configextractlocation. Is used to format location comments in the .po file.
-sortByMsgid boolean - The resulting output will be sorted alphabetically. https://ttag.js.org/docs/plugin-api.html#configsortbymsgid
-useProjectBabelrc boolean - Ttag cli will use projects babel config files. https://ttag.js.org/docs/plugin-api.html#useProjectBabelrcDescription
-foldLength line width in .po file
$3
will replace all strings with translations from the .po file
#### Arguments:
-discover string overrides babel-plugi-ttag setting - https://ttag.js.org/docs/plugin-api.html#configdiscover. Can be used to discover ttag functions without explicit import. Only known ttag functions can be used as params (t, jt, ngettext, gettext, _)
-numberedExpressions boolean overrides babel-plugin-ttag setting - https://ttag.js.org/docs/plugin-api.html#confignumberedexpressions. Refer to the doc for the details.
-extractLocation string - 'full' | 'file' | 'never' - https://ttag.js.org/docs/plugin-api.html#configextractlocation. Is used to format location comments in the .po file.
-sortByMsgid boolean - The resulting output will be sorted alphabetically. https://ttag.js.org/docs/plugin-api.html#configsortbymsgid
-useProjectBabelrc boolean - Ttag cli will use projects babel config files. https://ttag.js.org/docs/plugin-api.html#useProjectBabelrcDescription
$3
will output po(t)file with pretty colors on, combine with | less -r
$3
will output a pseudo-localised translation
#### Arguments:
-output --o result file with pseudo translations (.po) (default: pseudo.po)
$3
will spellcheck po file messages with given locale, locale can be autodetected from pofile
$3
will validate js template strings (${x}`) in messages and translations and against each otherPlease support ttag-cli development by sending issues/PRs.