Klient Weblate¶
Instalim¶
The Weblate Client is shipped separately and includes the Python module. To use the commands below, you need to install wlc using pip:
pip install wlc
You can also execute it directly using uvx:
uvx wlc --help
Ndihmëz
You can also use this wlc as a Python module, see wlc.
Përdorim Docker-i¶
The Weblate Client is also available as a Docker image.
The image is published on Docker Hub: https://hub.docker.com/r/weblate/wlc
Installing:
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.
The command to launch the container uses the following syntax:
docker run --rm weblate/wlc [WLC_ARGS]
Shembull:
docker run --rm weblate/wlc --url https://hosted.weblate.org/api/ list-projects
You might want to pass your Kartela Formësimi to the Docker container. When
your repository contains a project configuration such as .weblate, the
easiest approach is to add your current directory as the
/home/weblate volume:
docker run --volume $PWD:/home/weblate --rm weblate/wlc show
Si t’ia fillohet¶
The easiest way to get started is to create a personal
wlc configuration in ~/.config/weblate (see
Kartela Formësimi for the full discovery rules and other locations):
[weblate]
url = https://hosted.weblate.org/api/
[keys]
https://hosted.weblate.org/api/ = APIKEY
You can then invoke commands on the default server:
wlc ls
wlc commit sandbox/hello-world
Shihni edhe
Legacy configuration¶
Ndryshuar në versionin 1.17: The legacy configuration using unscoped key is no longer supported.
Migrate legacy configuration:
[weblate]
url = https://hosted.weblate.org/api
key = YOUR_KEY_HERE
To a configuration with key scoped to an API URL:
[weblate]
url = https://hosted.weblate.org/api
[keys]
https://hosted.weblate.org/api = YOUR_KEY_HERE
Synopsis¶
wlc [arguments] <command> [options]
Commands actually indicate which operation should be performed.
Përshkrim¶
Weblate Client is a Python library and command-line utility to manage Weblate remotely
using API REST e Weblate-it. The command-line utility can be invoked as wlc and is
built-in on wlc.
Argumente¶
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}¶
Përcaktoni formatin e përfundimeve.
- --url URL¶
Specify the API URL. Overrides any value found in the configuration file, see Kartela Formësimi. The URL should end with
/api/, for examplehttps://hosted.weblate.org/api/.
- --key KEY¶
Specify the API user key to use. Overrides any value found in the configuration file, see Kartela Formësimi. You can find your key in your profile on Weblate.
- --config PATH¶
Load configuration only from
PATHinstead of the discovered global and project configuration files, see Kartela Formësimi.
- --config-section SECTION¶
Overrides configuration file section in use, see Kartela Formësimi.
Urdhra¶
Janë gati urdhrat vijues:
- version¶
Shtyp versionin e tanishëm.
- list-languages¶
Paraqet gjuhët e përdorura në Weblate.
- list-projects¶
Paraqet projekte në Weblate.
- list-components¶
Paraqet përbërës në Weblate.
- list-translations¶
Paraqet përkthime në Weblate.
- show¶
Shows Weblate object (translation, component or project).
- ls¶
Lists Weblate object (translation, component or project).
- commit¶
Commits changes made in a Weblate object (translation, component or project).
- pull¶
Pulls remote repository changes into Weblate object (translation, component or project).
- push¶
Pushes Weblate object changes into remote repository (translation, component or project).
- reset¶
Resets changes in Weblate object to match remote repository (translation, component or project).
- cleanup¶
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¶
Displays detailed statistics for a given Weblate object (translation, component or project).
- lock-status¶
Shfaq gjendje kyçjeje.
- lock¶
Locks component from further translation in Weblate.
- unlock¶
Bën shkyçjen e përkthimit të përbërësit Weblate.
- changes¶
Shfaq ndryshime për një objekt të dhënë.
- download¶
Shkarkon një kartelë përkthimi.
- --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¶
Ngarkon një kartelë përkthimi.
- --overwrite¶
Mbishkruaj përkthime ekzistuese gjatë ngarkimit.
- --input¶
File from which content is read, if left unspecified it is read from stdin.
- --method¶
Upload method to use, see Import methods.
- --fuzzy¶
Fuzzy (marked for edit) strings processing (empty,
process,approve)
- --author-name¶
Author name, to override currently authenticated user
- --author-email¶
Author e-mail, to override currently authenticated user
Ndihmëz
You can get more detailed information on invoking individual commands by
passing --help, for example: wlc ls --help.
Kartela Formësimi¶
When --config is provided, wlc loads only that file.
Without --config, wlc first loads the discovered global
configuration file from the standard platform-specific locations:
C:\Users\NAME\AppData\Roaming\weblate.iniGlobal configuration file on Windows in the roamed profile.
C:\Users\NAME\AppData\Local\weblate.iniGlobal configuration file on Windows in the local profile.
~/.config/weblateGlobal configuration file on Unix-like systems.
/etc/xdg/weblateSystem-wide fallback configuration file.
The program follows the XDG specification, so you can adjust the placement of
config files by environment variables XDG_CONFIG_HOME or
XDG_CONFIG_DIRS.
On Windows APPDATA and LOCALAPPDATA directories are the preferred
locations for the configuration file.
After loading the global configuration, wlc loads the nearest project configuration file from the current directory or its parents:
.weblate,.weblate.ini,weblate.iniProject configuration file placed in the repository.
Only the closest project configuration file is loaded. Configuration files in farther parent directories are ignored.
Following settings can be configured in the [weblate] section (you can
customize this by --config-section):
- key
Hequr në versionin 1.17: Use the
[keys]section to specify keys scoped for individual API URLs, see Legacy configuration.
- url
API server URL, defaults to
http://127.0.0.1:8000/api/.
- translation
Path to the default translation - component or project.
- retries, timeout, allowed_methods, backoff_factor, status_forcelist
Optional HTTP retry and timeout settings passed to
urllib3. Useallowed_methodsto list the request methods that may be retried. Current wlc releases use this setting name in place of the oldermethod_whitelistoption.
Kartela e formësimit, është një kartelë INI, për shembull:
[weblate]
url = https://hosted.weblate.org/api/
translation = weblate/application
retries = 3
allowed_methods = PUT,POST,GET
backoff_factor = 0.2
status_forcelist = 429,500,502,503,504
timeout = 30
The API keys are 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. In CI, keep only the repository configuration in
version control and inject the API key using WLC_KEY.
Environment variables¶
Shtuar në versionin 1.18.0.
The API URL and key can also be configured using environment variables. This is
especially useful for CI workflows where the repository provides the project
configuration and WLC_KEY is injected as a secret:
- WLC_URL¶
URL API
- WLC_KEY¶
Kyç API
The configuration precedence (highest to lowest) is:
Shembuj¶
Shtyp të dhëna versioni aktual të programit:
$ wlc version
version: 0.1
Paraqit krejt projektet:
$ 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/
Ngarkoni kartela përkthimesh:
$ 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