LinuxCommandLibrary

argos-translate

Translate text from one language to another

TLDR

Install translation pairs for Spanish to English translation

$ argospm install translate-es_en
copy

Translate some text from Spanish (es) to English (en) (Note: Only two letter language codes are supported)
$ argos-translate --from-lang es --to-lang en [un texto corto]
copy

Translate a text file from English to Hindi
$ cat [path/to/file.txt] | argos-translate --from-lang en --to-lang hi
copy

List all installed translation pairs
$ argospm list
copy

Show translation pairs from English that are available to be installed
$ argospm search --from-lang en
copy

Update installed language package pairs
$ argospm update
copy

Translate from ar to ru (Note: This requires the translation pairs translate-ar_en and translate-en_ru to be installed)
$ argos-translate --from-lang ar --to-lang ru [صورة تساوي أكثر من ألف كلمة]
copy

SYNOPSIS

argos-translate [OPTIONS] [TEXT]
argos-translate [OPTIONS] --file <FILE>
argos-translate --list-models
argos-translate --install-model <MODEL> [OPTIONS]
argos-translate --remove-model <MODEL>
argos-translate --update-model [OPTIONS]

PARAMETERS

-s, --from-lang <LANGUAGE_CODE>
    Specify the source language (e.g., 'en' for English). Required for translation if not auto-detected.

-t, --to-lang <LANGUAGE_CODE>
    Specify the target language (e.g., 'es' for Spanish). Required for translation.

--model <MODEL_ID>
    Specify a particular model to use for translation, overriding auto-selection.

--file <INPUT_FILE>
    Read input text for translation from the specified file instead of standard input or command arguments.

--output-file <OUTPUT_FILE>
    Write translated output to the specified file instead of standard output.

--list-models
    List all currently installed language models and available models for installation.

--install-model <MODEL_ID>
    Download and install a language model. <MODEL_ID> can be 'all' or a specific model identifier (e.g., 'en-es').

--remove-model <MODEL_ID>
    Remove an installed language model from your system.

--update-model
    Check for and update all installed language models to their latest versions.

--json
    Output the translation result in JSON format, useful for scripting.

-v, --verbose
    Enable verbose output, showing more details about the translation process.

-q, --quiet
    Suppress most output, showing only the translated text.

--version
    Display the argos-translate version information.

--help
    Display the help message and exit.

DESCRIPTION

argos-translate is a free, open-source command-line interface (CLI) tool for performing neural machine translation entirely offline. It allows users to translate text between various languages without an internet connection, ensuring data privacy as no information leaves your local machine. The tool utilizes pre-trained language models, which can be easily managed directly from the command line, including listing available models, installing new ones, updating, or removing existing ones. Text can be provided via standard input, specified files, or as a direct argument. argos-translate is built on the Argos Translate library, providing a robust, fast, and private solution for developers and users needing local, on-demand translation capabilities.

CAVEATS

Model Installation Required: Before performing any translation, the relevant language models must be downloaded and installed using the --install-model option. These models can be substantial in size.
Performance: Translation speed can vary significantly based on your system's hardware (CPU/GPU) and the complexity/size of the models.
Translation Quality: While generally good, the quality of translation can differ across language pairs and may not always match the fluency of human translation or proprietary cloud services.

OFFLINE OPERATION & PRIVACY

One of the primary advantages of argos-translate is its ability to perform translations entirely offline. Once models are installed, no internet connection is required, ensuring that sensitive text data never leaves your local machine. This makes it an excellent choice for privacy-conscious users or environments with limited internet access.

MODEL MANAGEMENT

argos-translate provides robust features for managing language models. Users can easily list available models (--list-models), install specific models or all available models (--install-model <MODEL_ID> or --install-model all), remove unwanted models (--remove-model <MODEL_ID>), and keep their installed models up-to-date (--update-model). Models are typically stored in a user-specific data directory.

HISTORY

Argos Translate, the underlying library, was developed by P. J. Sanson and is based on principles from the OpenNMT project. Its creation was driven by a need for a free, open-source, and privacy-respecting offline neural machine translation solution. The argos-translate command-line tool serves as the primary user interface to this library, providing easy access to its powerful translation capabilities for Linux users and developers since its initial releases.

SEE ALSO

trans(1), sed(1), awk(1), grep(1)

Copied to clipboard