@intl-schematic/cli
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-rc.7 • Public • Published

@intl-schematic/cli (WIP)

npm i -D @intl-schematic/cli

intl-schematic, as well as its plugins, defines a JSON-schema API designed specifically to allow type-checking JSON translation documents.

This CLI allows to quickly create such a schema based on the intl-schematic plugins you have currently installed.

Using the CLI

Broken right now, see manual definition.

To quickly define the translation.schema.json for your translation documents, you can run the official CLI in your project's root:

npx intl-schematic init
# or provide an optional custom file name
npx intl-schematic init ./locales/my-translation.schema.json

And then use it in your translation document:

// en.json
{
  // Path to the schema from the example above
  "$schema": "./translation.schema.json",
  "key": "Translation of my key"
}
import translation from './en.json';

const t = createTranslator(() => translation);

// Etc., see example at the start of this file

Note: the $schema key will be automatically excluded
from type hints for t() for your convenience!

Package Sidebar

Install

npm i @intl-schematic/cli

Weekly Downloads

9

Version

1.0.0-rc.7

License

MIT

Unpacked Size

15.8 kB

Total Files

12

Last publish

Collaborators

  • raiondesu