New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multiple Python versions #16
Comments
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.update-pots.py
script support multiple Python versionsThe text was updated successfully, but these errors were encountered: