CLI

@inlang/cli is a command line interface (CLI) tool that allows you to interact with the Inlang infastructure.

Installation

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

or

Commands

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

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

npx is auto-installed with Node and NPM.

The following commands are available with the inlang CLI:

config

The config command is used to interactively configure and create the inlang.config.json file.

config init

This command scans your file system hierarchy and finds out how your localization files are setup. It returns a complete config for you to use in your project, which you can modify to your needs.

To use the config init command, simply run:

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

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:

This command reads the inlang.config.js file in the repository and retrieves the resources and reference language specified in the configuration. It then translates all messages from the reference language to other languages defined in the configuration.

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.

Note: The inlang.config.js file must be present in the repository for the translation to work.

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:

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://inlang.com/editor/. The editor will be opened in your default browser.