Crowdin CLI è uno strumento di linea di comando che ti consente di gestire e sincronizzare le risorse di localizzazione con il tuo progetto Crowdin:
Questa è una cross-platform e si esegue in un terminale basato su Linux e sistemi operativi macOS o nel Prompt dei Comandi su Windows. È anche open-source ed è codice d’origine disponibile a GitHub.
upload
commanddownload
commandControlla che tu abbia Java 8 o più nuovo installato. Digita il comando Java -version
nel terminale (Prompt dei Comandi su Windows) per controllare la versione di Java. Per esempio, java version “1.8.0_212” significa che hai Java 8 Aggiornamento 212 installato.
Se non hai Java installato, scaricalo dal sito web di Oracle.
To install the Crowdin CLI with homebrew (the package manager for macOS):
$ brew tap crowdin/crowdin
$ brew install crowdin@3
Scarica ed esegui installatore per Windows.
Firmiamo tutti i nostri pacchetti con la Chiave di Firma Crowdin.
Scarica ed installa la chiave di firma pubblica:
get -qO - Https://artifacts.crowdin.con/repo/GPG-KEY-crowdin | sudo apt-key add -
Using the following command, create the crowdin.list file in the /etc/apt/sources.list.d directory:
echo "deb https://artifacts.crowdin.com/repo/deb/ /" > /etc/apt/sources.list.d/crowdin.list
E la tua repository è pronta all’uso. Puoi installare il pacchetto Debian di Crowdin CLI con:
sudo apt-get update && sudo apt-get install crowdin3
Per installare la CLI di Crowdin manualmente:
$ wget https://artifacts.crowdin.com/repo/deb/crowdin3.deb -O crowdin.deb $ sudo dpkg -i crowdin.deb
Firmiamo tutti i nostri pacchetti con la Chiave di Firma Crowdin.
Scarica ed installa la chiave di firma pubblica:
rpm --import https://artifacts.crowdin.com/repo/GPG-KEY-crowdin
Installare dalla Repository RPM
Crea un file chiamato crowdin.repo nella directory /etc/yum.repos.d contenente:
[crowdin] name=Crowdin repository baseurl=https://artifacts.crowdin.com/repo/rpm gpgcheck=1 gpgkey=https://artifacts.crowdin.com/repo/GPG-KEY-crowdin enabled=1
E la tua repository è pronta all’uso. Ora puoi installare Crowdin CLI con uno dei comandi seguenti:
sudo yum install crowdin3 sudo dnf install crowdin3
Per installare la CLI di Crowdin manualmente:
$ wget https://artifacts.crowdin.com/repo/rpm/crowdin3.rpm -O crowdin.rpm $ sudo rpm -U crowdin3.rpm
Visit the Crowdin CLI package page on Arch Linux user repository.
Installing from the NPM repository
npm i -g @crowdin/cli
La CLI di Crowdin può essere installata come una applicazione indipendente Java.
./install-crowdin-cli.sh
nel terminale con i diritti sudo per poter aggiungere il comando crowdin
al tuo terminalesetup-crowdin.bat
per aggiungere il comando crowdin
al Prompt dei ComandiCrowdin CLI provides a possibility to work with a proxy server. Each time you run a command, Crowdin CLI checks whether the operating system has the configured environment variables.
Supported environment variables:
HTTP_PROXY_HOST
– the name or the IP address of the host at which the proxy server is located HTTP_PROXY_PORT
– the port used by the proxy server for listening HTTP_PROXY_USER
– the username used for authentication on a proxy server HTTP_PROXY_PASSWORD
– the password used for authentication on a proxy server
Usa il metodo seguente per eseguire l’app:
$ crowdin
Metodo alternativo:
$ java -jar crowdin-cli.jar
Per usare Crowdin CLI devi avere un file di configurazione. Raccomandiamo di nominarlo crowdin.yml. Puoi crearlo eseguendo il comando:
$ crowdin init
Quando chiami Crowdin CLI nel terminale dovresti essere nella directory di root del tuo progetto. Altrimenti, dovrai specificare un percorso del file di configurazione usando l’opzione --config
:
$ Crowdin caricare fonti --config /path/to/your/config/file
Esegui crowdin help
per ottenere ulteriori dettagli riguardanti altri comandi.
Campione file configurazione:
"project_id": "projectId" #open project and go to Tools > API
"api_token": "personal-access-token" #open profile settings and go to API > New Token > create Token
"base_path": "." #path to your project directory on a local machine
"base_url": "https://crowdin.com"
"preserve_hierarchy": true
"files": [
{
"source": "/en/**/*.json", #source files filter
"translation": "/%two_letters_code%/**/%original_file_name%" #where translations are stored
}
]
For more information on how to configure Crowdin CLI, read the Configuration File article.
Una volta che il file di configurazione è creato, sei pronto ad iniziare ad usare la CLI di Crowdin per gestire le tue risorse di localizzazione e la tua sincronizzazione file automatizzata.
To show help information about Crowdin CLI:
$ crowdin help
Per generare una scheletro del file di configurazione:
$ crowdin init
Per controllare il file di configurazione per errori generali:
$ crowdin lint
Per mostrare una lista di file caricati in Crowdin:
$ crowdin list project
Per caricare file risorse in Crowdin:
$ crowdin upload sources
To specify the target languages the source files shouldn’t be translated into:
$ crowdin upload sources --excluded-language uk fr
Per caricare un file singolo senza configurazione:
$ crowdin upload sources -s "..." -t "..." -T personal-token -i project-id
Usa segnaposti per mettere le variabili appropriate.
Per mostrare una lista di file che saranno caricati in Crowdin:
$ crowdin upload sources --dryrun
To delete obsolete files from a Crowdin project:
$ crowdin upload sources --delete-obsolete
Per caricare traduzioni esistenti in Crowdin (le traduzioni saranno sincronizzate):
$ crowdin carica traduzioni
Per mostrare un’informazione dettagliata sul comando upload
:
$ crowdin upload --help
To add existing or new labels to the source strings:
$ crowdin upload sources -s "..." -t "..." --label "main-menu" --label "application"
Read more about Labels.
To download source files from Crowdin:
$ crowdin download sources
Per scaricare le ultime traduzioni da Crowdin:
$ crowdin download
Per scaricare le ultime traduzioni per la lingua specifica (codici lingua):
$ crowdin download -l {language_code}
Per mostrare una lista delle ultime traduzioni da Crowdin:
$ crowdin download --dryrun
Per mostrare un’informazione dettagliata sul comando download
:
$ crowdin download --help
Regardless of the initial source file format, you can download translation files in the Android XML, iOS Strings, and XLIFF formats.
It’s beneficial when localizing mobile app content or when the final translation file format differs from the initial source format. You can use beforehand generated source files or send strings to your Crowdin project directly from design tools. When translations are finished, you can download them in the needed format and easily integrate them into the codebase.
To launch custom exporters and download files in the necessary format:
$ crowdin download targets <name>
Add the targets
section to your crowdin.yml
configuration file with the following structure:
targets: [
{
name: "android",
files: [
{
file: "targets/%two_letters_code%/android.xml",
sources: [
"file.xlsx"
],
labels: [
"mobile",
"ui"
]
}
]
}
]
name
- the name of your target. Will be used for downloading specific targets.files
- the section that describes the resulting files that appear in your system after the download. Each target supports the downloading of multiple files.file
- the resulting file pattern. Currently supported file formats are the following: Android XML (.xml), iOS Strings (.strings), and XLIFF. New file formats are coming soon.sources
- the source files in Crowdin, whose translations should be exported. Alternatively, you can specify either branches
or directories
.labels
- Labels for the strings filtering (Optional).As a result, the file.xlsx
translations (filtered by labels mobile
and ui
) will be downloaded to targets/%two_letters_code%/android.xml
file.
You can configure and download pseudo-localized translation files.
To download an archive with pseudo-localized translation files:
$ crowdin download --pseudo
Add the pseudo_localization
section to your crowdin.yml
configuration file with the following structure:
pseudo_localization: {
length_correction: 25,
prefix: "",
suffix: "",
character_transformation: "cyrillic"
}
Read more about Pseudo-localization.
You can manage (add, delete) version branches in a project.
To create a new version branch:
$ crowdin branch add {branch_name}
To delete a version branch:
$ crowdin branch delete {branch_name}
Also, you can create version branches during the file upload.
Per caricare i file risorsa al ramo versione specificato:
$ crowdin carica risorse -b {branch_name}
Per caricare traduzioni al ramo versione specificato:
$ crowdin carica traduzioni -b {branch_name}
Per caricare traduzioni dal ramo versione specificato:
$ crowdin download -b {branch_name}
You can manage (add, edit, delete) source strings for the following file types: CSV, RESX, JSON, Android XML, iOS strings, PROPERTIES.
To show a list of source strings in the current project (use the --verbose
option to see more information):
$ crowdin string list
To show a list of source strings for a specified version branch in a project:
$ crowdin string list --branch {branch_name}
To create a new source string (use --label
to add labels to the strings you’re creating):
$ crowdin string add
To delete source string:
$ crowdin string delete
To edit existing source string (use --label
to add labels to the strings you’re editing):
$ crowdin string edit
Use the -h
option to see all possible command options.
You can check the translation and proofreading progress for a project using the following commands.
To show both translation and proofreading progress for a project:
$ crowdin status
To show both translation and proofreading progress for a specified version branch in a project:
$ crowdin status --branch {branch_name}
To show translation progress for a project:
$ crowdin status translation
To show proofreading progress for a project:
$ crowdin status proofreading
Also, you can use the --verbose
option to see more information. Use -h
option to see all possible command options.
You can upload and download glossaries.
To show a list of glossaries (use the --verbose
option to show term lists for glossaries):
$ crowdin glossary list
To upload glossary from a file (in TBX file format) either to the specified glossary or to a new one:
$ crowdin glossary upload
To upload glossary from a file (in CSV or XLS/XLSX file format) either to the specified glossary or to a new one:
$ crowdin glossary upload <file> --scheme term_en=0 --scheme description_en=1 --scheme partOfSpeech_en=2 --first-line-contains-header
To form the scheme for your CSV or XLS/XLSX glossary file, use the following constants:
term_{language_code}
– Column contains terms. {column_number}
– Column number. Numbering starts from 0. description_{language_code}
– Column contains term descriptions. partOfSpeech_{language_code}
– Column contains part of speech for terms. where {language_code}
– Language code for the specified language. See the full list of Supported Languages. --first-line-contains-header
– used to skip the import of the first row (header).
To download glossary to a file (in TBX, CSV, or XLS/XLSX file format) from the specified glossary:
$ crowdin glossary download
You can upload and download translation memories.
To show a list of translation memories:
$ crowdin tm list
To upload translation memory from a file (in TMX file format) either to the specified translation memory or to a new one:
$ crowdin tm upload
To upload translation memory from a file (in CSV or XLS/XLSX file format) either to the specified translation memory or to a new one:
$ crowdin tm upload <file> --scheme en=0 --scheme fr=1 --first-line-contains-header
To form the scheme for your CSV or XLS/XLSX translation memory file, use the following constants:
{language_code}
– Column contains translation memory elements for the specified language. {column_number}
– Column number. Numbering starts from 0. where {language_code}
– Language code for the specified language. See the full list of Supported Languages. --first-line-contains-header
– Used to skip the import of the first row (header).
To download translation memory to a file (in TMX, CSV, or XLS/XLSX file format) from the specified translation memory:
$ crowdin tm download
You can pre-translate source files that match the wild-card pattern and are stored in the current Crowdin project. You can use the pre-translation via TM or MT.
To run pre-translation via TM:
$ crowdin pre-translate --method tm
To run pre-translation via MT:
$ crowdin pre-translate --method mt --engine-id=...
Use -h
option to see all possible command options.
You can list target languages that are used in the current project.
To display a list of target languages:
$ crowdin list languages
Use -h
option to see all possible command options.