Weblate Client¶
バージョン 2.7 で追加: There has been full wlc utility support ever since Weblate 2.7. If you are using an older version some incompatibilities with the API might occur.
Installation¶
The Weblate Client is shipped separately and includes the Python module.
To use the commands below, you need to install wlc
:
pip3 install wlc
Getting started¶
The wlc configuration is stored in ~/.config/weblate
, please create it to
match your environment:
[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
Synopsis¶
wlc [parameter] <command> [options]
Commands actually indicate which operation should be performed.
解説¶
Weblate Client is a Python library and command-line utility to manage Weblate remotely
using API. The command-line utility can be invoked as wlc and is
built-in on wlc
.
Site wide options¶
The program accepts the following options for a whole instance, which must be entered before any subcommand.
-
--format
{csv,json,text,html}
¶ Specify the output format.
-
--url
URL
¶ Specify the API URL. Overrides any value found in the configuration file, see Configuration files. 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 Configuration files. You can find your key in your profile on Weblate.
-
--config
PATH
¶ Overrides the configuration file path, see Configuration files.
-
--config-section
SECTION
¶ Overrides configuration file section in use, see Configuration files.
Subcommands¶
The following subcommands are available:
-
version
¶
Prints the current version.
-
list-languages
¶
Lists used languages in Weblate.
-
list-projects
¶
Lists projects in Weblate.
-
list-components
¶
Lists components in Weblate.
-
list-translations
¶
Lists translations in 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
¶
バージョン 0.7 で追加: Supported since wlc 0.7.
Resets changes in Weblate object to match remote repository (translation, component or project).
-
cleanup
¶
バージョン 0.9 で追加: Supported since 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).
-
statistics
¶
Displays detailed statistics for a given Weblate object (translation, component or project).
-
lock-status
¶
バージョン 0.5 で追加: Supported since wlc 0.5.
Displays lock status.
-
lock
¶
バージョン 0.5 で追加: Supported since wlc 0.5.
Locks component from further translation in Weblate.
-
unlock
¶
バージョン 0.5 で追加: Supported since wlc 0.5.
Unlocks translation of Weblate component.
-
changes
¶
バージョン 0.7 で追加: Supported since wlc 0.7 and Weblate 2.10.
Displays changes for a given object.
-
download
¶
バージョン 0.7 で追加: Supported since wlc 0.7.
Downloads a translation file.
-
--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.
-
Configuration files¶
.weblate
Per project configuration file
~/.config/weblate
User configuration file
/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
.
Following settings can be configured in the [weblate]
section (you can
customize this by --config-section
):
-
key
API KEY to access Weblate.
-
url
API server URL, defaults to
http://127.0.0.1:8000/api/
.
-
translation
Path to the default translation - component or project.
The configuration file is an INI file, for example:
[weblate]
url = https://hosted.weblate.org/api/
key = APIKEY
translation = weblate/master
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.
Examples¶
Print current program version:
$ wlc version
version: 0.1
List all projects:
$ wlc list-projects
name: Hello
slug: hello
source_language: en
url: http://example.com/api/projects/hello/
web: https://weblate.org/
web_url: http://example.com/projects/hello/
You can also designate what project wlc should work on:
$ cat .weblate
[weblate]
url = https://hosted.weblate.org/api/
translation = weblate/master
$ wlc show
branch: master
file_format: po
filemask: weblate/locale/*/LC_MESSAGES/django.po
git_export: https://hosted.weblate.org/git/weblate/master/
license: GPL-3.0+
license_url: https://spdx.org/licenses/GPL-3.0+
name: master
new_base: weblate/locale/django.pot
project: weblate
repo: git://github.com/WeblateOrg/weblate.git
slug: master
template:
url: https://hosted.weblate.org/api/components/weblate/master/
vcs: git
web_url: https://hosted.weblate.org/projects/weblate/master/
With this setup it is easy to commit pending changes in the current project:
$ wlc commit