Skip to content

Commit

Permalink
Update PyTransifex with the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry authored and 3nids committed Feb 21, 2023
1 parent 4eaac83 commit 01c2fe9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

env:
PROJECT_FOLDER: "qgispluginci"
PYTHON_VERSION_RELEASE: "3.8"
PYTHON_VERSION_RELEASE: "3.10"

jobs:
tests:
Expand All @@ -29,7 +29,7 @@ jobs:
python: [
# Do not make simultaneous tests, transifex and GitHub release will fail
# "3.6",
"3.9",
"3.10",
]

# "3.10",
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ build/
dist/
*.egg-info

*.orig

__pycache__/
*.pyc
*.tar
Expand Down
18 changes: 12 additions & 6 deletions qgispluginci/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def __init__(
"""
self.parameters = parameters
self._t = Transifex(
transifex_token, parameters.transifex_organization, i18n_type="QT"
api_token=transifex_token,
organization_name=parameters.transifex_organization,
i18n_type="QT",
)
assert self._t.ping()
plugin_path = self.parameters.plugin_path
Expand All @@ -57,7 +59,8 @@ def __init__(
f"{self.parameters.transifex_project}"
)
self._t.create_project(
slug=self.parameters.transifex_project,
project_slug=self.parameters.transifex_project,
private=False,
repository_url=self.parameters.repository_url,
source_language_code=parameters.translation_source_language,
)
Expand Down Expand Up @@ -168,16 +171,19 @@ def pull(self):
if lang not in existing_langs:
logger.debug(f"Creating missing language: {lang}")
self._t.create_language(
self.parameters.transifex_project,
lang,
[self.parameters.transifex_coordinator],
project_slug=self.parameters.transifex_project,
language_code=lang,
coordinators=[self.parameters.transifex_coordinator],
)
existing_langs.append(lang)
for lang in existing_langs:
ts_file = f"{self.parameters.plugin_path}/i18n/{self.parameters.transifex_resource}_{lang}.ts"
logger.debug(f"Downloading translation file: {ts_file}")
self._t.get_translation(
self.parameters.transifex_project, resource["slug"], lang, ts_file
project_slug=self.parameters.transifex_project,
resource_slug=resource["slug"],
language_code=lang,
path_to_output_file=ts_file,
)

def push(self):
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ PyGithub>=1.54,<1.58
PyQt5>=5.15,<5.16
pyqt5ac>=1.2,<1.3
python-slugify>=4.0,<8.1
pytransifex>=0.1.10,<0.2
pytransifex>=1.1.0,<2.0
pyyaml>=5.4,<6.1

0 comments on commit 01c2fe9

Please sign in to comment.