Command Line Interface

i18n4v npm package provides i18n4v command to support internatinalization. It extracts translatable strings from given input files like an xgettext command of gettext.

i18n for virtual DOM (i18n4v)

  Usage: i18n4v -o output.json [other options] <source files/dirs...>

  Options:

    -h, --help                    output usage information
    -V, --version                 output the version number
    -o, --output [path]           Output file path. You can add extension .js/.json.
    -i, --js-include [pattern]    Input JavaScript file pattern. Default is "((\.js)|(\.ts)|(.jsx))$"
    -e, --js-exclude [pattern]    Input JavaScript file filtering pattern.
    -h, --html-include [pattern]  Input HTML file pattern. Default is /((\.html)|(\.xhtml))$
    -x, --html-exclude [pattern]  Input HTML file filtering pattern.
    -f, --fill-copy               Fill key as default translation text
    --i18n [name]                 Specify i18n library file name

If output file exists already, it reads the content and add new words to it. It keeps existing content.

Basically this tool is used in shell script or batch file like this:

#!/bin/sh

./node_modules/.bin/i18n4v -o languges/en.json -f bin src
./node_modules/.bin/i18n4v -o languges/ja.json bin src

It searches the following strings as a key: