Cliant Gréasáin

Suiteáil

Seoltar an Weblate Client ar leithligh agus tá an modúl Python san áireamh ann. Chun na horduithe thíos a úsáid, ní mór duit wlc a shuiteáil ag baint úsáide as pip:

pip install wlc

Is féidir leat é a fhorghníomhú go díreach ag baint úsáide as uvx:

uvx wlc --help

Hint

Is féidir leat an wlc seo a úsáid mar mhodúl Python freisin, féach wlc.

Úsáid docker

Tá an Cliant Weblate ar fáil freisin mar íomhá Docker.

Tá an íomhá foilsithe ar Docker Hub: https://hub.docker.com/r/weblate/wlc

Suiteáil:

docker pull weblate/wlc

The Docker container uses Weblate Client defaults and connects to the API deployed on localhost. Configure the API URL and API key using the normal wlc arguments or environment variables, for example --url, --key, WLC_URL, and WLC_KEY. API keys are rejected over non-local http:// URLs by default; use HTTPS, loopback HTTP for local development, or explicitly opt in to insecure HTTP.

Úsáideann an t-ordú chun an coimeádán a sheoladh an chomhréir seo a leanas:

docker run --rm weblate/wlc [WLC_ARGS]

Sampla:

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

B’fhéidir gur mhaith leat do Comhaid chumraíochta a chur chuig an gcoimeádán Docker. Nuair a bhíonn cumraíocht tionscadail ar nós .weblate i do stór, is é an cur chuige is fusa ná d’eolaire reatha a chur leis mar an toirt /home/weblate:

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

When the mounted repository provides the API URL in project configuration and you pass an unscoped API key to the container, also pin the URL explicitly: WLC_KEY requires WLC_URL, and --key requires --url.

If the configured API URL uses non-local http:// and an API key is provided, the container refuses to send the key unless insecure HTTP is explicitly enabled. Prefer HTTPS; for legacy deployments, pass --allow-insecure-http or set WLC_ALLOW_INSECURE_HTTP.

Ag tosú

Is é an bealach is fusa le tosú ná cumraíocht phearsanta wlc a chruthú i ~/.config/weblate (féach Comhaid chumraíochta le haghaidh na rialacha fionnachtana iomlána agus suíomhanna eile):

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

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

Is féidir leat orduithe a agairt ansin ar an bhfreastalaí réamhshocraithe:

wlc ls
wlc commit sandbox/hello-world

Cumraíocht oidhreachta

Changed in version 1.17: Ní thacaítear a thuilleadh leis an seanchumraíocht a úsáideann key neamhscóipithe.

Cumraíocht oidhreachta a aistriú:

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

Chuig cumraíocht le heochair atá teoranta do URL API:

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

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

Achoimre

wlc [arguments] <command> [options]

Léiríonn orduithe i ndáiríre cén oibríocht ba cheart a dhéanamh.

Cur síos

Is leabharlann Python agus áirgiúlacht ordú-líne é Weblate Cliant chun Weblate a bhainistiú go cianda ag baint úsáide as API REST Weblate. Is féidir an áirgiúlacht líne ordaithe a agairt mar wlc agus tá sé ionsuite ar wlc.

Argóintí

Glacann an clár leis na hargóintí seo a leanas a shainíonn formáid aschuir nó a bhfuil Weblate mar shampla le húsáid. Ní mór iad seo a chur isteach roimh aon ordú.

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

Sonraigh an fhormáid aschuir.

--url URL

Sonraigh an URL API. Sáraíonn sé aon luach a fhaightear sa chomhad cumraíochta, féach Comhaid chumraíochta. Ba cheart go gcríochnódh an URL le /api/, mar shampla https://hosted.weblate.org/api/.

--key KEY

Specify the API user key to use. Overrides any value found in the configuration file, see Comhaid chumraíochta. You can find your key in your profile on Weblate. When the API URL is loaded from automatically discovered project configuration, --key must be used together with --url. API keys are rejected over non-local http:// URLs by default.

--allow-insecure-http

Allow sending API keys over non-local http:// URLs. Prefer HTTPS or loopback HTTP instead; this option is intended only for legacy deployments where HTTPS is not available. This option only enables insecure HTTP for the current run; omitting it does not disable allow_insecure_http from configuration.

--config PATH

Luchtaigh cumraíocht ó PATH amháin in ionad na gcomhad cumraíochta domhanda agus tionscadail a aimsíodh, féach Comhaid chumraíochta.

--config-section SECTION

Sáraítear an roinn comhaid cumraíochta atá in úsáid, féach Comhaid chumraíochta.

Orduithe

Tá na horduithe seo a leanas ar fáil:

version

Priontálann an leagan reatha.

list-languages

Liostaíonn na teangacha a úsáidtear i Weblate.

list-projects

Liostaíonn sé na tionscadail i Weblate.

list-components

Liostaíonn sé comhpháirteanna i Weblate.

list-translations

Liostaíonn sé aistriúcháin i Weblate.

show

Taispeáin réad Weblate (aistriúchán, comhpháirt nó tionscadal).

ls

Liostaíonn réad Weblate (aistriúchán, comhpháirt nó tionscadal).

commit

Geallann sé athruithe a dhéantar ar réad Weblate (aistriúchán, comhpháirt nó tionscadal).

pull

Tarraingíonn cianathruithe stórtha isteach i réad Weblate (aistriúchán, comhpháirt nó tionscadal).

push

Athraíonn oibiacht Weblate a bhrú isteach i cianthaisc (aistriúchán, comhpháirt nó tionscadal).

reset

Athshocraigh athruithe ar oibiacht Weblate chun cianthaisc a mheaitseáil (aistriúchán, comhpháirt nó tionscadal).

cleanup

Baintear aon athruithe neamhrianaithe i réad Weblate chun teacht leis an gcianstór (aistriúchán, comhpháirt nó tionscadal).

repo

Taispeánann sé stádas stór do réad Weblate ar leith (aistriúchán, comhpháirt nó tionscadal).

stats

Taispeánann sé staitisticí mionsonraithe maidir le réad Weblate ar leith (aistriúchán, comhpháirt nó tionscadal).

lock-status

Léiríonn stádas glasála.

lock

Glasáil an chomhpháirt ó aistriúchán breise i Weblate.

unlock

Díghlasáiltear aistriúchán comhpháirt Weblate.

changes

Taispeáin athruithe do réad ar leith.

download

Íosluchtaigh comhad aistriúcháin.

--convert

Athraíonn sé formáid comhaid, mura dtarlaíonn comhshó ar an bhfreastalaí mura bhfuil sé sonraithe agus íoslódáltar an comhad mar atá chuig an stór.

--output

Sonraítear an comhad chun an t-aschur a shábháil ann, má fhágtar é gan sonraíocht clóitear é chuig stdout.

upload

Uaslódálann sé comhad aistriúcháin.

--overwrite

Forscríobh aistriúcháin atá ann cheana féin agus iad á n-uaslódáil.

--input

Comhad óna léitear ábhar, mura bhfuil sé sonraithe léitear é ó stdin.

--method

Modh uaslódáil le húsáid, féach Modhanna allmhairithe.

--fuzzy

Próiseáil teaghráin doiléir (marcáilte le haghaidh eagarthóireachta) (folamh, próiseas, faomh)

--author-name

Ainm an údair, chun an t-úsáideoir fíordheimhnithe faoi láthair a shárú

--author-email

Ríomhphost an údair, chun an t-úsáideoir fíordheimhnithe faoi láthair a shárú

Hint

Is féidir leat faisnéis níos mionsonraithe a fháil maidir le horduithe aonair a agairt trí --help a chur isteach, mar shampla: wlc ls --help.

Comhaid chumraíochta

Nuair a chuirtear --config ar fáil, ní luchtóidh wlc ach an comhad sin.

Gan --config, luchtóidh wlc an comhad cumraíochta domhanda a aimsíodh ar dtús ó na suíomhanna caighdeánacha ardáin-shonracha:

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

Comhad cumraíochta domhanda ar Windows sa phróifíl fánaíochta.

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

Comhad cumraíochta domhanda ar Windows sa phróifíl áitiúil.

~/.config/weblate

Comhad cumraíochta domhanda ar chórais cosúil le Unix.

/etc/xdg/weblate

Comhad cumraíochta taca don chóras ar fad.

Leanann an clár sonraíocht XDG, mar sin is féidir leat suíomh na gcomhad cumraíochta a choigeartú de réir athróg timpeallachta XDG_CONFIG_HOMEXDG_CONFIG_DIRS.

Ar Windows is iad na heolairí APPDATA agus LOCALAPPDATA na suíomhanna is fearr don chomhad cumraíochta.

Tar éis an chumraíocht dhomhanda a luchtú, luchtóidh wlc an comhad cumraíochta tionscadail is gaire ón eolaire reatha nó óna thuismitheoirí:

.weblate, .weblate.ini, weblate.ini

Comhad cumraíochta tionscadail curtha sa stórlann.

Ní luchtaítear ach an comhad cumraíochta tionscadail is gaire. Déantar neamhaird de chomhaid chumraíochta i gcomhadlanna tuismitheora níos faide i gcéin.

Is féidir na socruithe seo a leanas a chumrú sa rannán [weblate] (is féidir leat é seo a shaincheapadh trí --config-section):

key

Removed in version 1.17: Úsáid an chuid [keys] chun eochracha a shonrú atá raon feidhme do URLanna API aonair, féach Cumraíocht oidhreachta.

url

URL freastalaí API, réamhshocraithe go http://127.0.0.1:8000/api/.

translation

Conair chuig an aistriúchán réamhshocraithe - comhpháirt nó tionscadal.

allow_insecure_http

Allow API keys over non-local http:// URLs, defaults to false. Loopback HTTP URLs, such as http://127.0.0.1:8000/api/, remain allowed for local development without this option. Prefer HTTPS instead of enabling this setting. Automatically discovered project configuration files cannot enable this option; set it in user configuration, an explicit --config file, WLC_ALLOW_INSECURE_HTTP, or --allow-insecure-http. The setting is cumulative: any trusted source that enables insecure HTTP is enough, and false or unset values from command-line or environment sources do not disable it.

retries, timeout, allowed_methods, backoff_factor, status_forcelist

Socruithe roghnacha athiarrachta agus sos ama HTTP curtha chuig urllib3. Úsáid allowed_methods chun na modhanna iarrata is féidir a athiarracht a liostáil. Úsáideann na heisiúintí reatha wlc an t-ainm socraithe seo in ionad an rogha method_whitelist atá ann cheana.

Is comhad INI é an comhad cumraíochta, mar shampla:

[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
allow_insecure_http = false

Stóráiltear eochracha an API sa rannán [keys]:

[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. The [keys] lookup is scoped to the exact API URL.

In CI, unscoped keys must pin the API URL explicitly: set both WLC_URL and WLC_KEY, or use --url together with --key.

Athróga timpeallachta

Added in version 1.18.0.

Changed in version 2.0.1: Unscoped API keys require an explicit API URL when project configuration is discovered automatically. API keys are rejected over non-local http:// URLs unless insecure HTTP is explicitly enabled.

The API URL and key can also be configured using environment variables. This is especially useful for CI workflows where WLC_URL pins the destination and WLC_KEY is injected as a secret:

WLC_URL

URL API

WLC_KEY

API key. When the API URL would otherwise come from automatically discovered project configuration, WLC_KEY is accepted only together with WLC_URL. API keys are rejected over non-local http:// URLs by default.

WLC_ALLOW_INSECURE_HTTP

Set to 1, true, yes, or on to allow API keys over non-local http:// URLs. Prefer HTTPS or loopback HTTP instead. Other values, such as 0 or false, are treated as unset and do not disable allow_insecure_http from configuration.

The same protection applies to command-line arguments: --key is accepted with automatically discovered project configuration only when --url is provided.

The API URL and key configuration precedence (highest to lowest) is:

  1. Argóintí líne ordaithe (--url, --key).

  2. Athróga timpeallachta (WLC_URL, WLC_KEY).

  3. Cumraíocht luchtaithe ó --config, nó ón gcumraíocht dhomhanda a aimsíodh móide an chumraíocht tionscadail is gaire nuair nach n-úsáidtear --config.

The insecure HTTP opt-in is enable-only rather than a normal precedence setting. It is enabled when --allow-insecure-http is passed, when WLC_ALLOW_INSECURE_HTTP has a true value, or when allow_insecure_http is enabled in trusted configuration. Automatically discovered project configuration cannot enable it; set it in user configuration or pass an explicit --config file instead.

Samplaí

Priontáil leagan reatha an chláir:

$ wlc version
version: 0.1

Liostaigh gach tionscadal:

$ 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/

Uaslódáil comhad aistriúcháin:

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

Is féidir leat a ainmniú freisin cén tionscadal wlc ba chóir a bheith ag obair air:

$ 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/

Leis an socrú seo is furasta athruithe a dhéanamh ar feitheamh ar an tionscadal reatha:

$ wlc commit