weblateorg / wlc Goto Github PK
View Code? Open in Web Editor NEWWeblate command line client
Home Page: https://weblate.org/
License: GNU General Public License v3.0
Weblate command line client
Home Page: https://weblate.org/
License: GNU General Public License v3.0
Add support for downloading all translations from component/project, with option to specify it's parameters (for example file format).
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
➔ wlc version
version: 0.5
➔ wlc
Traceback (most recent call last):
File "/usr/bin/wlc", line 9, in <module>
load_entry_point('wlc==0.5', 'console_scripts', 'wlc')()
File "/usr/share/python3.5/site-packages/wlc/main.py", line 545, in main
command = COMMANDS[args.cmd](args, config, stdout)
KeyError: None
➔
It's probably reasonable to switch to the requests instead of currently used urllib. This will be especially useful for more complex things (see #8 (comment)).
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
Dockerfile
python 3.12.4-alpine
.github/workflows/closing.yml
peter-evans/create-or-update-comment v4
peter-evans/create-or-update-comment v4
ubuntu 22.04
.github/workflows/codeql-analysis.yml
actions/checkout v4
github/codeql-action v3
github/codeql-action v3
github/codeql-action v3
ubuntu 22.04
.github/workflows/dockerimage.yml
actions/checkout v4
docker/setup-buildx-action v3.6.1
actions/cache v4
actions/checkout v4
docker/setup-qemu-action v3.2.0
docker/setup-buildx-action v3.6.1
actions/cache v4
actions/checkout v4
docker/setup-buildx-action v3.6.1
actions/cache v4
actions/checkout v4
docker/setup-buildx-action v3.6.1
actions/cache v4
actions/checkout v4
anchore/scan-action v4
github/codeql-action v3
actions/upload-artifact v4
actions/checkout v4
docker/setup-buildx-action v3.6.1
actions/cache v4
actions/checkout v4
aquasecurity/trivy-action 0.24.0
github/codeql-action v3
actions/upload-artifact v4
actions/checkout v4
docker/setup-qemu-action v3.2.0
docker/setup-buildx-action v3.6.1
actions/cache v4
actions/cache v4
actions/cache v4
actions/checkout v4
docker/setup-qemu-action v3.2.0
docker/setup-buildx-action v3.6.1
actions/cache v4
actions/cache v4
actions/cache v4
docker/login-action v3
ubuntu 22.04
ubuntu 22.04
ubuntu 22.04
ubuntu 22.04
ubuntu 22.04
ubuntu 22.04
ubuntu 22.04
.github/workflows/label-sync.yml
actions/checkout v4
srealmoreno/label-sync-action v1
ubuntu 22.04
.github/workflows/labels.yml
peter-evans/create-or-update-comment v4
peter-evans/create-or-update-comment v4
peter-evans/create-or-update-comment v4
peter-evans/create-or-update-comment v4
peter-evans/create-or-update-comment v4
ubuntu 22.04
.github/workflows/pre-commit.yml
actions/checkout v4
actions/cache v4
actions/setup-python v5
ubuntu 22.04
.github/workflows/pull_requests.yaml
peter-evans/enable-pull-request-automerge v3
.github/workflows/readme-sync.yml
actions/checkout v4
peter-evans/dockerhub-description v4
ubuntu 22.04
.github/workflows/setup.yml
actions/checkout v4
actions/setup-python v5
ubuntu 22.04
.github/workflows/stale.yml
actions/stale v9
ubuntu 22.04
.github/workflows/super-linter.yml
actions/checkout v4
github/super-linter v5.0.0
ubuntu 22.04
.github/workflows/test.yml
actions/checkout v4
actions/setup-python v5
codecov/codecov-action v4
pyproject.toml
requests >=2.25.0
urllib3 >=1.26
lint/pre-commit ==3.8.0
test/responses >=0.10.1,<0.26.0
test/build ==1.2.1
test/twine ==5.1.1
setuptools >=61.2
.pre-commit-config.yaml
pre-commit/pre-commit-hooks v4.6.0
adrienverge/yamllint v1.35.1
astral-sh/ruff-pre-commit v0.5.5
asottile/blacken-docs 1.18.0
macisamuele/language-formatters-pre-commit-hooks v2.14.0
executablebooks/mdformat 0.7.17
igorshubovych/markdownlint-cli v0.41.0
fsfe/reuse-tool v4.0.3
.pre-commit-config.yaml
mdformat-gfm 0.3.6
mdformat-black 0.1.1
mdformat-shfmt 0.1.0
.github/workflows/dockerimage.yml
docker/buildx v0.16.2
docker/buildx v0.16.2
docker/buildx v0.16.2
docker/buildx v0.16.2
docker/buildx v0.16.2
docker/buildx v0.16.2
docker/buildx v0.16.2
I was wondering if a new version of wlc could be released soon? We require this feature for our Weblate integration projects.
I'd like to programmatically access the category name, to be able to filter components by category later on.
wlc
exposing the category endpoints in Python API.
HTTP requests not using the wlc
, but some other general library.
No response
No response
When running wlc I get an SSL error stating the certificate verification failed.
My Weblate installation is running on a server with a valid ssl certificate. Accessing the API using e.g. Chrome or Postman works.
I've installed certifi and ran the Install\ Certificates.command
I've found while searching for a solution. The error when running wlc remains.
Running the WLC docker image results in the same error.
Run wlc list-projects
Working API output
Full output:
wlc --url https://..../api list-projects
Request failed: HTTPSConnectionPool(host='....', port=443): Max retries exceeded with url: /api/projects/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)')))
No response
No response
williamdes@williamdes:/mnt/Dev/@phpmyadmin/theREALphpMyAdminREPO$ docker run --rm weblate/wlc
Unable to find image 'weblate/wlc:latest' locally
docker: Error response from daemon: manifest for weblate/wlc:latest not found: manifest unknown: manifest unknown.
See 'docker run --help'.
williamdes@williamdes:/mnt/Dev/@phpmyadmin/theREALphpMyAdminREPO$ docker pull weblate/wlc
Using default tag: latest
Error response from daemon: manifest for weblate/wlc:latest not found: manifest unknown: manifest unknown
Why: there is no latest tag on docker hub
Fix: replace weblate/wlc
by weblate/wlc:edge
in docs
Please also document how to bind a local config file .weblate
using docker
docker run -v $(pwd):/home/weblate --rm weblate/wlc:edge show
Source for /home/weblate
:
Line 13 in e2139fb
Feel free to add this example
$ docker run -v $(pwd):/home/weblate --rm weblate/wlc:edge show
branch: QA_5_1
file_format: po
filemask: po/*.po
git_export: https://hosted.weblate.org/git/phpmyadmin/5-1/
license: GPL-3.0-or-later
license_url: https://www.gnu.org/licenses/gpl-3.0-standalone.html
name: 5.1
new_base: po/phpmyadmin.pot
project: phpmyadmin
repo: https://github.com/phpmyadmin/phpmyadmin.git
slug: 5-1
source_language: en
template:
url: https://hosted.weblate.org/api/components/phpmyadmin/5-1/
vcs: git
web_url: https://hosted.weblate.org/projects/phpmyadmin/5-1/
Creating projects and components is now supported by the API, so it would be great to have this supported in the wlc as well.
Moved from https://github.com/nijel/weblate/issues/1293
We would like to establish a workflow where we have more control over the time when translations are pulled into the main project and would find it handy to use wlc to download the files.
Right now, we use a seperate git repo that is included through a submodule, but submodules always need a bit more attention than a simple folder would.
How are the ideas on implementing this?
While the API offer filtering of components that are part of a project (GET /api/projects/(string: project)/components/) and translations that are part of a component (GET /api/components/(string:project)/(string:component)/translations/) the command line does not supports it.
Hi,
I'm currently writing a Python script to automatically download translation files from Weblate but all methods returns an empty dict.
For example this code:
import wlc
import wlc.config
config = wlc.config.WeblateConfig('weblate')
config.load('.weblate')
w = wlc.Weblate(config=config)
for i in w.list_projects():
print(i)
with this .weblate
file:
[weblate]
url = https://translate.maicol07.it/api/
key = MY_API_KEY
project = scheduled-exams
component = webapp
translation = scheduled-exams/webapp
[keys]
https://translate.maicol07.it/api/ = MY_API_KEY
returns:
{}
{}
{}
{}
What is wrong?
Thanks
When I try to use the wlc executable after a pip install, I got the following error:
Traceback (most recent call last):
File "/home/agacon/.local/bin/wlc", line 8, in <module>
sys.exit(main())
File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 829, in main
command = COMMANDS[args.command](args, config, stdout, stdin)
File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 143, in __init__
self.wlc = wlc.Weblate(config=config)
File "/home/agacon/.local/lib/python3.8/site-packages/wlc/__init__.py", line 105, in __init__
self.retries = Retry(
TypeError: __init__() got an unexpected keyword argument 'allowed_methods'
The command I run the following:
wlc --url https://weblate.osgeo.org/api --key MYAPIKEY ls
If I run the same command using the docker image, it works. What did I miss?
No response
No response
Traceback (most recent call last):
File "/home/agacon/.local/bin/wlc", line 8, in <module>
sys.exit(main())
File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 829, in main
command = COMMANDS[args.command](args, config, stdout, stdin)
File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 143, in __init__
self.wlc = wlc.Weblate(config=config)
File "/home/agacon/.local/lib/python3.8/site-packages/wlc/__init__.py", line 105, in __init__
self.retries = Retry(
TypeError: __init__() got an unexpected keyword argument 'allowed_methods'
### Additional context
_No response_
Just to assure myself - is there a way how to use wlc.Weblate.post(path, **kwargs)
to upload a translation file?
Or should I rather stick with requests
library?
Hi.
Noticing these issues in the build process.
===> Configuring for py36-wlc-1.1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "setup.py", line 25, in <module>
VERSION = __import__("wlc").__version__
File "/wrkdirs/usr/ports/devel/py-wlc/work-py36/wlc-1.1/wlc/__init__.py", line 23, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
*** Error code 1\
===> Configuring for py36-wlc-1.2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "setup.py", line 26, in <module>
VERSION = __import__("wlc").__version__
File "/wrkdirs/usr/ports/devel/py-wlc/work-py36/wlc-1.2/wlc/__init__.py", line 25, in <module>
import dateutil.parser
ModuleNotFoundError: No module named 'dateutil'
*** Error code 1
As they are called in __init__.py
, they need to be on setup_requires()
, not only on install_requires()
, or the init code needs to be moved to another place.
Regards.
I just installed wlc 1.5 on Windows 10.
It's hard for me to understand how to proceed.
The help at https://docs.weblate.org/en/latest/wlc.html is not helping a Windows user.
Anyway, I have created a weblate.ini
file.
When I run in PowerShell:
wlc --config "C:\Users\Michele\Documents\app\weblate.ini"
the answer is always:
usage: wlc [-h] [--format {text,csv,json,html}] [--version] [--debug] [--config CONFIG] [--config-section CONFIG_SECTION] [--key KEY] [--url URL]
{version,list-projects,list-components,list-languages,list-translations,show,delete,ls,commit,push,pull,reset,cleanup,repo,changes,stats,lock-status,lock,unlock,download,upload}
...
wlc: error: the following arguments are required: cmd
SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
Python 3.10, setuptools 63.4.3
Comment at https://github.com/WeblateOrg/wlc/pull/44/files#r828286201
One good reason to provide root
access within the container is to give GitLab/Github/... users a root access to install additional packages before using weblate.
In my case I just need to apk add make
(because I have to run one wlc download
command per language) which is not possible if I've no root access within the container.
See also the limitation of GitLab wrt override the image selected user: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2750
docker run -ti --entrypoint=/bin/sh weblate/wlc -c whoami
root
(So that apk
works too)
No response
weblate
No response
For projects migrating from Transifex it would be useful to have migration tool to import translations from Transifex into Weblate.
There is API for the download: https://docs.transifex.com/api/translations
Example curl snippet to download colorhug-client Czech translation:
curl -L --user api:TOKEN https://www.transifex.com/api/2/project/colorhug-client/resource/master/translation/cs/?file
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
subj.
Describe the issue
I already tried
Describe the steps you tried to solve the problem yourself.
To Reproduce the issue
Steps to reproduce the behavior:
Expected behavior
No Error
Output after the second run
The first run just shows the additional downloads.
Collecting wlc
Using cached wlc-1.10-py3-none-any.whl (84 kB)
Requirement already satisfied: pyxdg in c:\program files\python39\lib\site-packages (from wlc) (0.27)
Requirement already satisfied: python-dateutil in c:\program files\python39\lib\site-packages (from wlc) (2.8.1)
Requirement already satisfied: argcomplete in c:\program files\python39\lib\site-packages (from wlc) (1.12.2)
Requirement already satisfied: requests in c:\program files\python39\lib\site-packages (from wlc) (2.25.1)
Requirement already satisfied: six>=1.5 in c:\program files\python39\lib\site-packages (from python-dateutil->wlc) (1.15.0)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\program files\python39\lib\site-packages (from requests->wlc) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\program files\python39\lib\site-packages (from requests->wlc) (2020.12.5)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\program files\python39\lib\site-packages (from requests->wlc) (1.26.3)
Requirement already satisfied: idna<3,>=2.5 in c:\program files\python39\lib\site-packages (from requests->wlc) (2.10)
Installing collected packages: wlc
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\programme\\python39\\Lib\\site-packages\\wlc\\test_data\\api\\projects-hello-components--POST--branch=master--file_format=po--filemask=po--.po--git_export=--license=--license_url=--name=Weblate--slug=weblate--repo=file----home-nijel-work-weblate-hello--template=--new_base=--vcs=git'
The file with the endless name in fact doesn't exist.
wlc list-projects fails with:
name: Freeplane
slug: freeplane
Traceback (most recent call last):
File "/usr/bin/wlc", line 11, in <module>
load_entry_point('wlc==1.2', 'console_scripts', 'wlc')()
File "/usr/lib/python3/dist-packages/wlc/main.py", line 703, in main
command.run()
File "/usr/lib/python3/dist-packages/wlc/main.py", line 336, in run
self.print(list(self.wlc.list_projects()))
File "/usr/lib/python3/dist-packages/wlc/main.py", line 225, in print
self.print_text(value, header)
File "/usr/lib/python3/dist-packages/wlc/main.py", line 203, in print_text
"{0}: {1}".format(key, self.format_value(getattr(item, key)))
File "/usr/lib/python3/dist-packages/wlc/__init__.py", line 245, in __getattr__
return self._data[name]
KeyError: 'source_language'
Reported version (wlc --version):
wlc 1.2
This was installed via Ubuntu 20.10 official package
It would be very handy to have a docker image for wlc
. I this way the client machine does not need to have python, pip or other software specific tooling installed.
Being able to run something as:
docker run --rm weblate/wlc commit
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Traceback (most recent call last):
File "XXX/wlc-1.13/wlc/test_main.py", line 31, in
from .test_base import APITest
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "XXX/wlc-1.13/wlc/test_wlc.py", line 37, in
from .test_base import APITest
ImportError: attempted relative import with no known parent package
No response
No response
No response
No response
Installing 'wlc.test_data' as data is deprecated, please list it in packages
.
Installing 'wlc.test_data.api' as data is deprecated, please list it in packages
.
Installing 'wlc.test_data.mock' as data is deprecated, please list it in packages
.
No response
No response
No response
Changes described: https://setuptools.pypa.io/en/latest/userguide/datafiles.html
I fix in setup.cfg:
[options]
-packages = wlc
-python_requires = >=3.6
+packages =
+ wlc
+ wlc.test_data
+ wlc.test_data.api
+ wlc.test_data.mock
package_dir = wlc=wlc
-include_package_data = 1
+python_requires = >=3.6
+include_package_data = True
$ cat po/merch.json
{
"merch": "Material promocional"
}
$ wlc upload habitica/merch/gl -i po/merch.json --overwrite
$ wlc download habitica/merch/gl -o po/merch.json
$ cat po/merch.json
{
"merch": "Material de promoción"
}
I can reproduce this with 1.13 and with 71e636d. I can also reproduce it if I use GNU Gettext (PO) as exchange format instead.
This is against https://translate.habitica.com/ (Weblate 4.15.2).
API result
within the wlc code is {'not_found': 0, 'skipped': 1, 'accepted': 0, 'total': 1, 'result': False, 'count': 1}
. So the translation is being skipped, no idea why.
It would be useful to have a command to set the fuzzy (need review) flag on a string, with the ability to do that on all existing strings. I'm not sure if this is the kind of use that is intended for wlc though.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I'm on latest released wlc and using a relatively new self-hosted Weblate instance, and have the problem that the results don't have a "result" attribute, e.g. if I pull or commit:
wlc pull --url=XYZ project
Traceback (most recent call last):
File "bin/wlc", line 8, in <module>
sys.exit(main())
File "wlc/main.py", line 833, in main
command.run()
File "wlc/main.py", line 514, in run
self.check_result(result, "Failed to pull changes!")
File "wlc/main.py", line 290, in check_result
if not result["result"]:
KeyError: 'result'
I looked at the code here and the wlc code still expects "result", but when I skim the code in api, I couldn't find anywhere where it adds a "result" attribute. The tests don't seem to look for that attribute either. Am I missing something or is there some kind of mismatch between the command-line client and the server?
Hi. Is is possible to lock a single language of a single component?
I've managed to lock a whole component, but it's too wide.
Overall, I find the doc a but confusing. Wlc is supposed to operate on "objects". But when you "wlc ls" or 'list-components", etc, it's not quite clear what is the name of the "object" that is supposed to be used on command line.
When the same file (same content) is uploaded repeatedly the upload status is
Failed to upload translations!
This does not happen when uploading a file with different content.
ls (or list-translations) using --format json for the associated component fails with
TypeError: Object of type datetime is not JSON serializable while trying to serialize last_change
$ dpkg -l python3-xdg
ii python3-xdg 0.26-1ubuntu1 all Python 3 library to access freedesktop.org standards
Using Ubuntu 20.04.4 LTS pyxdg version.
requirements.txt
should put a version constraint.
No response
No response
It works using apt purge
+ pip3 install --user pyxdg
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.