ttag-cli 0.0.7
Install from the command line:
Learn more about npm packages
$ npm install @goatapp/ttag-cli@0.0.7
Install via package.json:
"@goatapp/ttag-cli": "0.0.7"
About this version
⚠️ This project was previously namedc-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 files.
npm install ttag-cli
# or global
npm install -g ttag-cli
ttag extract some.js
will extract translations to .pot file
--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. Will sort output in alphabetically by msgid. https://ttag.js.org/docs/plugin-api.html#configsortbymsgid
will check if all translations are present in .po file
--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.
will merge two or more po(t) files together using first non-empty msgstr and header from left-most file
will open interactive prompt to translate all msgids with empty msgstr in cli
--output -o result file with translations (.po) (default: translated.po)
will display various pofile statistics(encoding, plurals, translated, fuzzyness)
will filter pofile by entry attributes(fuzzy, obsolete, (un)translated)
--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: )
ttag filter -nt small.po
msgid "test"
msgstr ""
will create an empty .po file with all necessary headers for the locale
--lang sets default locale (ISO format) (default: en)
--filename path to the .po file
will update existing po file. Add/remove new translations
--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. Will sort output in alphabetically by msgid. https://ttag.js.org/docs/plugin-api.html#configsortbymsgid
will replace all strings with translations from the .po file
--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.
will output po(t)file with pretty colors on, combine with | less -r
will spellcheck po file messages with given locale, locale can be autodetected from pofile
will validate js template strings (${x}
) in messages and translations and against each other
will open pofile in web editor
will parse and output po file as loadable JSON
--pretty -p pretty print js (default: false)
--nostrip --n do not strip comments/headers (default: false)
--format sets the output JSON format (compact is much smaller)
[choices: "compact", "verbose", "nested"] [default: "verbose"]
If format
is "nested", the json will be nested under a field of which the key is the language
field from the po. e.g.,
{
"zh-CN": {
"headers": "",
// ...rest of the po json
}
}
Please support ttag-cli development by sending issues/PRs.