Cliant Gréasáin

Suiteáil

Déantar an Weblate Client a dháileadh ar leithligh agus cuimsítear an modúl Python ann. Coinnítear an cód foinseach i stórlann WeblateOrg/wlc. Chun na horduithe thíos a úsáid, ní mór duit wlc a shuiteáil le 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.

Foilsítear íomhánna ar Docker Hub agus ar GitHub Container Registry. Baintear úsáid as ainm na híomhá ó Docker Hub sna samplaí thíos.

Suiteáil:

docker pull weblate/wlc

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

latest

An eisiúint chobhsaí is déanaí.

Leagan iomlán, mar shampla 2.2.0

Eisiúint chobhsaí shonrach.

Príomhleagan, mar shampla 2

An eisiúint chobhsaí is déanaí sa tsraith mhór sin.

edge

An leagan forbartha reatha ón bpríomh-bhrainse.

edge-YYYY-MM-DD-COMMIT

Grianghraf sealadach sonrach den fhorbairt.

Chun íomhá a thógáil ón bhfoinse a tarraingíodh anuas:

docker build -t weblate/wlc .

Úsáideann an coimeádán Docker réamhshocruithe Cliant Weblate agus nascann sé leis an API atá imscartha ar localhost. Cumraigh URL an API agus eochair an API ag baint úsáide as na hargóintí wlc nó na hathróga comhshaoil gnáth, mar shampla --url, --key, WLC_URL, agus WLC_KEY. Diúltaítear eochracha API thar URLanna http://` neamh-áitiúla de réir réamhshocraithe; bain úsáid as HTTPS, HTTP lúbtha siar le haghaidh forbartha áitiúla, nó roghnaigh go sainráite isteach i HTTP neamhshlán.

Ú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

Nuair a sholáthraíonn an stór feistithe URL an API i gcumraíocht an tionscadail agus nuair a chuireann tú eochair API neamhscóipeáilte ar fáil don choimeádán, socraigh an URL go sainráite freisin: teastaíonn WLC_URL le haghaidh WLC_KEY, agus teastaíonn --url le haghaidh --key. Teastaíonn an péireáil chéanna do na roghanna sáraithe --allow-insecure-http agus --allow-insecure-ssl.

Má úsáideann an URL API cumraithe seoladh http:// nach bhfuil áitiúil agus má chuirtear eochair API ar fáil, diúltóidh an coimeádán an eochair a sheoladh mura gcuirtear HTTP neamhshlán ar chumas go sainráite. Is fearr HTTPS a úsáid; i gcás imlonnuithe oidhreachta, bain úsáid as --allow-insecure-http nó socraigh WLC_ALLOW_INSECURE_HTTP. Déantar deimhnithe TLS a fhíorú i gcónaí de réir réamhshocraithe, lena n-áirítear URLanna lúba-ais (loopback). Ná húsáid --allow-insecure-sslWLC_ALLOW_INSECURE_SSL ach amháin nuair nach féidir fíorú deimhnithe a chur ar chumas.

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.

Changed in version 2.2.0: Ní thacaítear a thuilleadh leis an gcumraíocht dhomhanda allow_insecure_http. Ina áit sin, cumraigh bunús sa rannán [insecure_http].

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 fóntas líne-ordaithe é Weblate Client chun Weblate a bhainistiú go cianda trí úsáid a bhaint as API REST Weblate. Glaoigh ar an bhfóntas líne-ordaithe mar wlc; féach wlc le haghaidh an API Python.

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. Is é text an réamhshocrú.

--version

Priontáil leagan an chláir agus scoir. Tacaíonn an t-ordú version le formáidiú aschuir agus is féidir leis uimhir an leagain amháin a phriontáil.

--debug

Priontáil cumarsáid HTTP fholaithe. Déantar luachanna ceanntásca údaraithe a cheilt agus ní logáiltear comhlachtaí na n-iarratas, ach déantar paraiméadair an cheiste; ná cuir rúin i bparaiméadair an cheiste.

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

Sonraigh an eochair úsáideora API le húsáid. Sáraíonn sé aon luach a fhaightear sa chomhad cumraíochta, féach Comhaid chumraíochta. Is féidir leat d'eochair a fháil i do phróifíl ar Weblate. Nuair a luchtaítear URL an API ó chumraíocht tionscadail a aimsítear go huathoibríoch, ní mór --key a úsáid in éineacht le --url. Diúltaítear d'eochracha API thar URLanna http:// neamh-áitiúla de réir réamhshocraithe.

--allow-insecure-http

Ceadaítear eochracha API a sheoladh trí URLanna http:// nach URLanna áitiúla iad. Is fearr HTTPS nó HTTP lúb-ais (loopback) a úsáid ina n-ionad; níl an rogha seo beartaithe ach le haghaidh imscaradh seanchóras nach bhfuil HTTPS ar fáil iontu. Ní chuireann an rogha seo HTTP neamhshlán ar chumas ach don rith reatha amháin. Nuair a thagann URL an API ó chumraíocht tionscadail a aimsíodh go huathoibríoch, teastaíonn --url leis an rogha seo.

--allow-insecure-ssl

Díchumasaigh fíorú teastais TLS don rith reatha. Déantar teastais a fhíorú de réir réamhshocraithe do gach URL HTTPS, lena n-áirítear URLanna lúb-ais (loopback). Nuair a thagann URL an API ó chumraíocht tionscadail a aimsíodh go huathoibríoch, teastaíonn --url leis an rogha seo.

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

Roghnaíonn sé an rannán den chomhad cumraíochta le húsáid in áit [weblate]; féach Comhaid chumraíochta.

Conairí réad

Glacann orduithe a oibríonn ar réad le ceann de na cosáin seo:

PROJECT

Aitheantóir an tionscadail.

PROJECT/COMPONENT

Component slug, including its project.

PROJECT/COMPONENT/LANGUAGE

Translation language, including its project and component.

UNIT_ID

Numeric translation unit ID. Only commands that explicitly support units accept this form.

Commands that require an object use the translation setting from Comhaid chumraíochta when the path is omitted. The ls and download commands also use this setting before falling back to their no-object behavior. For list-components and list-translations, an omitted object always requests an instance-wide list.

Orduithe

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

version

Priontálann an leagan reatha.

--bare

Prints only the version number.

list-languages

Lists all languages in Weblate.

list-projects

Lists all projects in Weblate.

list-components

Lists all components in Weblate, or components in the specified project.

list-translations

Lists all translations in Weblate, or translations in the specified component.

list-units

Lists units in the specified translation.

--query QUERY

Filters units using the search query syntax.

show

Shows a project, component, translation, or unit.

delete

Deletes a project, component, translation, or unit without a confirmation prompt.

ls

Lists all projects when no object is specified, components in a project, or translations in a component.

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

Displays the lock status of a component.

lock

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

unlock

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

changes

Displays changes for a project, component, or translation.

download

Downloads translation files. For a translation, wlc writes the file to --output or to redirected standard output. It refuses to write raw file content to an interactive terminal.

For a component or project, --output is required and is treated as a directory. wlc writes one ZIP archive per component. With no object, it downloads every component in the Weblate instance in the same way.

--convert FORMAT

Requests conversion to FORMAT on the server. If unspecified, no conversion happens.

--output PATH

Specifies the output file for a translation or output directory for a component, project, or instance-wide download. Use - to write a translation to standard output.

--no-glossary

Excludes glossary components from component, project, and instance-wide downloads.

upload

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

--overwrite

Overwrites existing translated strings. This is equivalent to --conflicts replace-translated.

--conflicts {ignore,replace-translated,replace-approved}

Selects how conflicts with existing translations are handled.

--input PATH

Reads content from PATH. If unspecified or -, content is read from standard input.

--method {translate,approve,suggest,fuzzy,replace,source,add}

Upload method to use, see Modhanna allmhairithe. The default is translate.

--fuzzy {process,approve}

Selects processing of fuzzy strings (marked for edit).

--author-name NAME

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

--author-email EMAIL

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

edit-unit

Updates a translation unit. At least one update option is required.

--target TARGET [TARGET ...]

Sets one or more translated strings.

--state STATE

Sets the unit state: 0 for empty, 10 for fuzzy, 20 for translated, or 30 for approved.

--explanation EXPLANATION

Sets the string explanation.

--extra-flags FLAGS

Sets additional string flags.

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.

~/.config/weblate.ini

Alternative global configuration filename on Unix-like systems.

/etc/xdg/weblate

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

/etc/xdg/weblate.ini

Alternative system-wide fallback filename.

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.

Project configuration is loaded after global configuration and overrides matching settings. It can select the API URL, default object, request settings, and a matching URL-scoped API key, allowing a cloned repository to automatically select its Weblate server and translation.

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

Default object path for commands that accept one: a project, component, translation, or numeric unit ID.

retries, timeout, allowed_methods, backoff_factor, status_forcelist

HTTP request retry and timeout settings. retries defaults to 0 and backoff_factor to 0. status_forcelist is a comma-separated list of HTTP status codes that trigger retries and is empty by default.

allowed_methods lists methods that may be retried, separated by commas or whitespace. It defaults to HEAD, DELETE, OPTIONS, PUT, and GET. These retry settings are passed to urllib3.util.Retry.

timeout is the request timeout in seconds and defaults to 300. Current wlc releases use allowed_methods in place of the older method_whitelist option.

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

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 complete configured API URL, not merely its network origin.

Project configuration can also supply or replace a matching entry in [keys]. Do not commit valuable API keys to version control; normally keep keys in personal configuration and only the API URL and default object in project configuration.

Insecure transport exceptions are stored in origin-scoped sections in trusted user configuration:

[insecure_http]
http://legacy.example.com:80 = true

[insecure_ssl]
https://legacy.example.com:443 = true

An origin consists of the scheme, normalized hostname, and effective port. The API path is ignored, while different schemes and ports remain isolated. The [insecure_http] section allows API keys over non-local HTTP for matching origins. The [insecure_ssl] section disables TLS certificate verification for matching origins.

Changed in version 2.2.0: TLS certificates are verified for all hosts by default. Insecure HTTP and TLS configuration is scoped to origins. Automatically discovered project configuration can neither add entries to these sections nor enable the removed global settings. User configuration and explicitly selected --config files are trusted.

I CI, ní mór d'eochracha neamhscóipeáilte an URL API a phionáil go sainráite: socraigh WLC_URL agus WLC_KEY araon, nó bain úsáid as --url mar aon le --key.

Athróga timpeallachta

Added in version 1.18.0.

Changed in version 2.0.1: Éilíonn eochracha API neamhscóipeáilte URL API sainráite nuair a aimsítear cumraíocht tionscadail go huathoibríoch. Diúltaítear d'eochracha API thar URLanna neamh-áitiúla http:// mura bhfuil HTTP neamhshlán cumasaithe go sainráite.

Changed in version 2.2.0: Insecure HTTP and TLS environment overrides require WLC_URL when the API URL would otherwise come from automatically discovered project configuration.

Is féidir URL agus eochair an API a chumrú ag baint úsáide as athróga comhshaoil freisin. Tá sé seo an-úsáideach go háirithe le haghaidh sreafaí oibre CI ina mbiorann WLC_URL an ceann scríbe agus ina n-instealltar WLC_KEY mar rún:

WLC_URL

URL API

WLC_KEY

Eochair API. Nuair a thiocfadh an URL API ó chumraíocht tionscadail a aimsítear go huathoibríoch murach sin, ní ghlactar le WLC_KEY ach amháin i dteannta WLC_URL. Diúltaítear eochracha API thar URLanna http:// neamh-áitiúla de réir réamhshocraithe.

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. When the API URL would otherwise come from automatically discovered project configuration, this variable is accepted only together with WLC_URL.

WLC_ALLOW_INSECURE_SSL

Set to 1, true, yes, or on to disable TLS certificate verification. Other values, such as 0 or false, are treated as unset. When the API URL would otherwise come from automatically discovered project configuration, this variable is accepted only together with WLC_URL.

The same protection applies to command-line arguments: --key, --allow-insecure-http, and --allow-insecure-ssl are accepted with automatically discovered project configuration only when --url is provided.

Is é URL an API agus tosaíocht chumraíochta eochrach (ón gceann is airde go dtí an ceann is ísle) ná:

  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 transport opt-ins are enable-only rather than normal precedence settings. They are enabled by a command-line or environment override, or by a matching origin in the trusted [insecure_http] or [insecure_ssl] section. Automatically discovered project configuration cannot add trusted origins.

Security model

Project configuration is part of the repository workflow and is intentionally trusted to select the API endpoint, default object, request settings, and a matching URL-scoped API key. Running wlc inside a repository authorizes its nearest project configuration to select the server that receives commands and uploads and supplies displayed or downloaded content. Use an explicit trusted --config file when this is not desired.

The command-line client accepts API keys from --key, WLC_KEY, or the [keys] section. It does not load HTTP authentication from .netrc or the file named by NETRC. Credentials embedded in API URLs are rejected; use an API key instead. Other Requests environment integration, including proxy and CA-bundle variables, remains enabled.

The wlc threat model documents the complete trust boundaries, security properties, non-goals, and downstream responsibilities. A version-matched copy is included in source and wheel distributions. Report security issues using the Weblate vulnerability reporting process.

Samplaí

Priontáil leagan reatha an chláir:

$ wlc version

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