Open m-aciek opened 12 months ago
After moving files updated components with a following script:
from dataclasses import dataclass
from os import getenv
from traceback import print_exc
from tqdm import tqdm
from wlc import Weblate, WeblateException, Project, Translation
@dataclass
class Version:
number: str
def is_latest(self):
return self.number == "3.12"
def weblate_category_name(self):
return self.number
def directory_name(self):
return self.is_latest() and "latest" or self.number
if __name__ == "__main__":
weblate_key = getenv('KEY')
weblate = Weblate(weblate_key, 'https://hosted.weblate.org/api/')
project = Project(weblate, 'https://hosted.weblate.org/api/projects/python-docs/')
for component in tqdm(project.list()):
if component.is_glossary:
continue
directory_name = Version(component.category.name).directory_name()
print(component.filemask.startswith(f'*/{directory_name}'), component.name, component.category.name, component.filemask)
if not component.filemask.startswith(f'*/{directory_name}'):
path = component.filemask.removeprefix('*/')
new_filemask = f'*/{directory_name}/{path}'
repo_link = f'weblate://python-docs/{directory_name}/bugs'
print(new_filemask, repo_link)
try:
component.patch(filemask=new_filemask, repo=repo_link)
except WeblateException as exception:
print_exc()
print('skipping')
Example of a string translation propagated from 3.12 to 3.11: https://hosted.weblate.org/translate/python-docs/3-11/tutorialerrors-1/pl/?checksum=3fddbeea5506bafe&sort_by=-priority,position#history.
Reopening, as after adding two versions in a language repository matrix, we are not able to fetch the changes from Weblate. We are hitting throttling treshold.
Not sure what to do now:
What if you change the components Version control system to GitHub Pull Request and set a schedule to automatically merge pull requests? This way I assume you wouldn't have to deal with throttling and Weblate pushes commits at its own time.
What if you change the components Version control system to GitHub Pull Request and set a schedule to automatically merge pull requests? This way I assume you wouldn't have to deal with throttling and Weblate pushes commits at its own time.
The issue is at a different place. “Weblate to python-docs-weblate (Weblate backend repo)” is set to Git (pure, without PRs) and it works just fine. “python-docs-weblate to language repository (like python-docs-pl-weblate-poc)“ has the issue.
With https://github.com/WeblateOrg/weblate/issues/7271 we would not require an interim Weblate backend repo, and we should be able to configure the “Weblate to language repository“ directly.
.update-pots.py
script support multiple Python versions