Client Weblate#

Installation#

The Weblate Client is shipped separately and includes the Python module. To use the commands below, you need to install wlc:

pip install wlc

Utilisation de Docker#

Le client Weblate est également disponible sous forme d’image Docker.

The image is published on Docker Hub: https://hub.docker.com/r/weblate/wlc

Installation :

docker pull weblate/wlc

The Docker container uses Weblate’s default settings and connects to the API deployed in localhost. The API URL and API_KEY can be configured through the arguments accepted by Weblate.

La commande pour lancer le conteneur utilise la syntaxe suivante :

docker run --rm weblate/wlc [WLC_ARGS]

Exemple :

docker run --rm weblate/wlc --url https://hosted.weblate.org/api/ list-projects

You might want to pass your Fichiers de configuration to the Docker container, the easiest approach is to add your current directory as /home/weblate volume:

docker run --volume $PWD:/home/weblate --rm weblate/wlc show

Pour commencer#

The wlc configuration is stored in ~/.config/weblate (see Fichiers de configuration for other locations), please create it to match your environment:

[weblate]
url = https://hosted.weblate.org/api/

[keys]
https://hosted.weblate.org/api/ = APIKEY

Vous pouvez alors invoquer des commandes sur le serveur par défaut :

wlc ls
wlc commit sandbox/hello-world

Synopsis#

wlc [arguments] <command> [options]

Commands actually indicate which operation should be performed.

Description#

Weblate Client is a Python library and command-line utility to manage Weblate remotely using API REST de Weblate. The command-line utility can be invoked as wlc and is built-in on wlc.

Arguments#

The program accepts the following arguments which define output format or which Weblate instance to use. These must be entered before any command.

--format {csv,json,text,html}#

Spécifiez le format de sortie.

--url URL#

Specify the API URL. Overrides any value found in the configuration file, see Fichiers de configuration. The URL should end with /api/, for example https://hosted.weblate.org/api/.

--key KEY#

Specify the API user key to use. Overrides any value found in the configuration file, see Fichiers de configuration. You can find your key in your profile on Weblate.

--config PATH#

Surcharge le chemin du fichier d’utilisation, voir Fichiers de configuration.

--config-section SECTION#

Surcharge la section du fichier d’utilisation en cours d’utilisation, voir Fichiers de configuration.

Commandes#

Les commandes suivantes sont disponibles :

version#

Imprime la version actuelle.

list-languages#

Liste les langues utilisées dans Weblate.

list-projects#

Liste des projets dans Weblate.

list-components#

Liste les composants dans Weblate.

list-translations#

Liste les traductions dans Weblate.

show#

Affiche l’objet Weblate (traduction, composant ou projet).

ls#

Liste les objets Weblate (traduction, composant ou projet).

commit#

Commits changes made in a Weblate object (translation, component or project).

pull#

Met à jour Weblate avec les modifications du dépôt distant (traduction, composant ou projet).

push#

Pousse les modifications Weblate vers le dépôt distant (traduction, composant ou projet).

reset#

Nouveau dans la version 0.7: Supporté depuis wlc 0.7.

Annule les modifications Weblate pour correspondre au dépôt distant (traduction, composant,ou projet).

cleanup#

Nouveau dans la version 0.9: Supporté depuis wlc 0.9.

Removes any untracked changes in a Weblate object to match the remote repository (translation, component or project).

repo#

Displays repository status for a given Weblate object (translation, component or project).

stats#

Affiche les statistiques détaillées d’un objet Weblate (traduction, composant ou projet).

lock-status#

Nouveau dans la version 0.5: Supporté depuis wlc 0.5.

Affiche l’état du verrouillage.

lock#

Nouveau dans la version 0.5: Supporté depuis wlc 0.5.

Locks component from further translation in Weblate.

unlock#

Nouveau dans la version 0.5: Supporté depuis wlc 0.5.

Déverrouille la traduction d’un composant Weblate.

changes#

Nouveau dans la version 0.7: Supporté depuis wlc 0.7 et Weblate 2.10.

Affiche les modifications d’un objet.

download#

Nouveau dans la version 0.7: Supporté depuis wlc 0.7.

Télécharge un fichier de traduction.

--convert#

Converts file format, if unspecified no conversion happens on the server and the file is downloaded as is to the repository.

--output#

Specifies file to save output in, if left unspecified it is printed to stdout.

upload#

Nouveau dans la version 0.9: Supporté depuis wlc 0.9.

Charge un fichier de traduction.

--overwrite#

Overwrite existing translations upon uploading.

--input#

Fichier à partir duquel le contenu est lu. S’il n’est pas spécifié, le contenu est lu à partir de l’entrée standard stdin.

--method#

Upload method to use, see Import methods.

--fuzzy#

Fuzzy (marked for edit) strings processing (empty, process, approve)

--author-name#

Nom de l’auteur, pour surcharger l’utilisateur actuellement connecté

--author-email#

Auteur du courriel, pour surcharger l’utilisateur actuellement connecté

Indication

Vous pouvez obtenir plus d’informations sur la commande en l’appelant avec l’option --help, par exemple : wlc ls --help.

Fichiers de configuration#

.weblate, .weblate.ini, weblate.ini

Fichier de configuration par projet

C:\Users\NAME\AppData\weblate.ini

Fichier de configuration utilisateur sous Windows.

~/.config/weblate

Fichier de configuration utilisateur

/etc/xdg/weblate

System wide configuration file

The program follows the XDG specification, so you can adjust placement of config files by environment variables XDG_CONFIG_HOME or XDG_CONFIG_DIRS. On Windows APPDATA directory is preferred location for the configuration file.

Following settings can be configured in the [weblate] section (you can customize this by --config-section):

key

Clé d’API pour accéder à Weblate.

url

URL du serveur API, par défaut http://127.0.0.1:8000/api/.

translation

Chemin vers la traduction par défaut - composant ou projet.

Le fichier de configuration est un fichier INI, par exemple :

[weblate]
url = https://hosted.weblate.org/api/
key = APIKEY
translation = weblate/application

Additionally API keys can be stored in the [keys] section:

[keys]
https://hosted.weblate.org/api/ = APIKEY

This allows you to store keys in your personal settings, while using the .weblate configuration in the VCS repository so that wlc knows which server it should talk to.

Exemples#

Imprimer la version actuelle du programme :

$ wlc version
version: 0.1

Lister tous les projets :

$ wlc list-projects
name: Hello
slug: hello
url: http://example.com/api/projects/hello/
web: https://weblate.org/
web_url: http://example.com/projects/hello/

Téléverser un fichier de traduction :

$ wlc upload project/component/language --input /tmp/hello.po

You can also designate what project wlc should work on:

$ cat .weblate
[weblate]
url = https://hosted.weblate.org/api/
translation = weblate/application

$ wlc show
branch: main
file_format: po
source_language: en
filemask: weblate/locale/*/LC_MESSAGES/django.po
git_export: https://hosted.weblate.org/git/weblate/application/
license: GPL-3.0+
license_url: https://spdx.org/licenses/GPL-3.0+
name: Application
new_base: weblate/locale/django.pot
project: weblate
repo: git://github.com/WeblateOrg/weblate.git
slug: application
template:
url: https://hosted.weblate.org/api/components/weblate/application/
vcs: git
web_url: https://hosted.weblate.org/projects/weblate/application/

With this setup it is easy to commit pending changes in the current project:

$ wlc commit