2.15.1 • Published 21 hours ago

@inlang/cli v2.15.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
21 hours ago

inlang CLI header image

Automate (i18n) localization tasks with the CLI

@inlang/cli is a command line interface (CLI) tool that allows you to interact with the Inlang infrastructure. It can be used to automate localization tasks, such as machine translation, linting, and more.

Get started with the CLI by using the following npx command:

npx @inlang/cli [command]

See all available commands here.

Let's get started

  1. Add a project.inlang folder to your repository
  2. Create a settings.json file to that new dir project.inlang/settings.json
  3. Install a plugin that reads and writes your messages from the inlang marketplace

  1. Optional Install lint rules to find errors in your translations from the inlang marketplace

Core features

Automate

You can use the CLI to automate localization tasks like machine translation, linting, and more.

Machine Translation

The CLI allows you to machine translate your resources. This is useful if you want to get a first draft of your translations and then have them reviewed by a human translator. Via machine translation, you can do translation automation e.g. in your CI/CD pipeline.

Validation

The CLI allows you to validate your inlang project. This is useful if you want to make sure that your configuration file is valid before you commit it to your repository.

Example of a dev doing translation automation

Installation

Install with package manager

You can install the @inlang/cli with this command:

npm install -D @inlang/cli

or

yarn add --dev @inlang/cli

best

npx @inlang/cli [command]

Minimum requirements

Minimum node version: v18.0.0

If one of the commands can't be found, you probably use an outdated CLI version. You can always get the latest version by running npx @inlang/cli@latest [command].

Commands

NameCommandDescription
CLI Versionnpx @inlang/cli@latest [command]Get the latest version of the inlang CLI.
Validatenpx @inlang/cli validate [options]Validate if the project is working correctly.
Lintnpx @inlang/cli lint [options]Lint translations using configured rules. Options include --no-fail, --project, and --languageTags.
Machinenpx @inlang/cli machine translate [options]Automate translation processes. Options include -f, --force, --project <path>, --sourceLanguageTag <source> and --targetLanguageTags <targets...>
Opennpx @inlang/cli open editorOpen parts of the Inlang infrastructure in your default browser, including the editor.
Modulenpx @inlang/cli module [command]Interact with Inlang modules, including initialization and building. Commands: init [options] Initialize a new inlang module codebase, build [options] build an inlang module. Options include --type, --entry, and --outdir.

Usage

We recommend using the CLI with npx to avoid installing the CLI globally. Not installing the CLI globally has the following advantages:

  • the installed CLI version is scoped to the project, ensuring it always works.
  • the CLI gets installed for team members, avoiding "why is this command not working for me" questions.

npx is auto-installed with Node and NPM.

If one of the commands can't be found, you probably use an outdated CLI version. You can always get the latest version by running npx @inlang/cli@latest [command].

CLI for inlang.

Options:
  -V, --version         output the version number
  -h, --help            display help for command

Commands:
  project [command]  Commands for managing your inlang project
  lint [options]     Commands for linting translations.
  machine [command]  Commands for automating translations.
  open [command]     Commands for open parts of the inlang ecosystem.
  module [command]   Commands for build inlang modules.
  help [command]     display help for command

The following commands are available with the inlang CLI:

machine

The machine command is used to automate localization processes.

machine translate

The translate command machine translates all resources.

To initiate machine translation, run the following command:

npx @inlang/cli machine translate

Options

The translate command has the following options:

  • -f, --force: If this option is set, the command will not prompt confirmation. This is useful for CI/CD build pipelines. We advise you to only use machine translate in build pipelines to avoid out-of-context/wrong translations.
  • --project <path>: Specifies the path to the project root. The default project root is the current working directory.
  • --sourceLanguageTag <source>: Specifies the source language tag.
  • --targetLanguageTags <targets...>: Specifies the target language tags as comma seperated list (e.g. sk,zh,pt-BR).

The translations are performed using machine translation services. The translated messages are added to the respective language resources. Finally, the updated resources are written back to the file system.

validate

Validates a project.

npx @inlang/cli validate --project ./path/to/{project-name}.inlang

Options

The validate command has the following options:

  • --project <path>: Specifies the path to the project root. The default project root is the current working directory.

This will launch an interactive prompt that will guide you through the process of migrating the inlang configuration file.

lint

The lint command lints the translation with the configured lint rules, for example, with the @inlang/plugin-standard-lint-rules.

npx @inlang/cli lint

Options

The translate command has the following options:

  • --no-fail: If this option is set, the command will not fail if there are any linting errors.
  • --project <path>: Specifies the path to the project root. The default project root is the current working directory.
  • --languageTags <tags>: Specifies the language tags to lint. Defaults to all. Should be a comma-separated list of language tags specified in the inlang project, e.g. en,de,fr.

lint will read through all resources and find potential errors and warnings in the translation strings, for example, with the @inlang/plugin-standard-lint-rules, it searches for missing messages, missing references and identical patterns/duplicates.

However, it's totally up to you how you configure your lints. You can build your own plugin with your customized set of lints with the @inlang/plugin-standard-lint-rules as a starter template.

open

The open command opens parts of the Inlang infrastructure in your default browser.

open editor

The editor command opens the Inlang editor for the current repository.

To open the Inlang editor, run the following command:

npx @inlang/cli open editor

This command retrieves the remote URL of the repository and constructs the URL for the Inlang editor by appending the GitHub user and repository to https://fink.inlang.com/. The editor will be opened in your default browser.

module

The module command is used to interact with the Inlang module. It allows to initialize a new module or run the modules build commands.

module init

The module init command initialize a new Inlang module in the current directory. This works only if the current directory is empty, so make sure to create a new folder.

To initialize a new module, run the following command:

npx @inlang/cli module init

Options

The init command has the following options: --type <type>: The module type. Currently, lintRule or plugin is supported.

module build

If you are developing an inlang module, the module build command builds your Inlang module for development & in production.

To build a module, run the following command:

npx @inlang/cli module build --entry ./path/to/index.ts --outdir ./path/to/dist

Options

--entry <entry>: Specifies the path to the module's entry point, typically src/index.js or src/index.ts. --outdir <path>: Specifies the output directory for the build files. The default output directory is "./dist." --watch: An optional flag that, when provided, enables a watch mode to monitor for changes and automatically rebuild the module when changes are detected.

See how there is also a --watch flag, which enables a watch mode to monitor for changes and automatically rebuild the module when changes are detected. This command runs with esbuild under the hood. -->

Troubleshoot

If something isn't working as expected or you are getting errors, make sure to run on the latest version of the CLI. You can always get the latest version by executing npx @inlang/cli@latest.

If the error persists, please create an issue – we're happy to help.

Pricing

2.15.0

21 hours ago

2.15.1

21 hours ago

2.14.1

8 days ago

2.14.0

14 days ago

2.13.7

18 days ago

2.13.6

19 days ago

2.13.5

20 days ago

2.13.4

22 days ago

2.13.2

1 month ago

2.13.3

1 month ago

2.13.1

1 month ago

2.13.0

1 month ago

2.12.6

2 months ago

2.12.5

2 months ago

2.12.4

2 months ago

2.12.3

2 months ago

2.12.2

2 months ago

2.12.1

3 months ago

2.12.0

3 months ago

2.11.0

3 months ago

2.10.1

3 months ago

2.8.0

3 months ago

2.10.0

3 months ago

2.7.0

3 months ago

2.9.0

3 months ago

2.6.0

3 months ago

2.5.0

3 months ago

2.4.0

4 months ago

2.3.0

4 months ago

2.2.0

4 months ago

2.1.0

5 months ago

1.2.0

8 months ago

1.14.0

6 months ago

1.0.0

8 months ago

1.12.0

6 months ago

1.18.0

6 months ago

1.16.0

6 months ago

1.8.0

7 months ago

1.6.0

7 months ago

1.4.0

7 months ago

0.13.0

10 months ago

0.13.1

10 months ago

1.21.0

5 months ago

0.13.2

10 months ago

0.13.3

10 months ago

2.0.0

5 months ago

1.11.0

7 months ago

1.15.0

6 months ago

1.1.0

8 months ago

1.13.0

6 months ago

1.19.0

6 months ago

1.17.0

6 months ago

1.9.0

7 months ago

1.7.0

7 months ago

1.5.0

7 months ago

1.3.0

7 months ago

0.12.0

10 months ago

1.20.0

6 months ago

1.10.0

7 months ago

0.11.7

10 months ago

0.11.6

10 months ago

0.9.12

11 months ago

0.9.8

11 months ago

0.9.13

11 months ago

0.9.7

11 months ago

0.9.14

11 months ago

0.9.15

11 months ago

0.9.9

11 months ago

0.9.4

11 months ago

0.9.3

11 months ago

0.9.10

11 months ago

0.9.6

11 months ago

0.9.11

11 months ago

0.9.5

11 months ago

0.9.16

11 months ago

0.11.0

10 months ago

0.10.1

11 months ago

0.11.1

10 months ago

0.11.2

10 months ago

0.11.3

10 months ago

0.11.4

10 months ago

0.11.5

10 months ago

0.10.0

11 months ago

0.9.0

11 months ago

0.8.1

11 months ago

0.8.0

12 months ago

0.9.2

11 months ago

0.9.1

11 months ago

0.7.0

12 months ago

0.6.1

12 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.5.4

1 year ago

0.5.5

1 year ago

0.2.2

1 year ago

0.6.0

12 months ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago