Skip to content
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

Review logging about downloading transifex files #258

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions qgispluginci/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,16 @@ def pull(self):
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}")
logger.debug(
f"Downloading translation file: {ts_file}, resource: {self.config.resource_slug}"
)
self.tx_client.get_translation(
language_code=lang,
path_to_output_file=ts_file,
)

def push(self):
resource = self.tx_client.get_resource()
self.tx_client.get_resource()
logger.debug(
f"Pushing resource: {self.parameters.transifex_resource} "
f"with file {self.ts_file}"
Expand Down
8 changes: 4 additions & 4 deletions qgispluginci/translation_clients/transifex.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ def get_translation(
)

r = requests.get(url)
# transifex returns None encoding and the apparent_encoding is Windows-1254 what leads to malformed result strings. So we set the encoding hardcoded to utf-8.
# Transifex returns None encoding and the apparent_encoding is Windows-1254 what leads to malformed
# result strings.
# So we set the encoding hardcoded to utf-8.
if not r.encoding:
r.encoding = "utf-8"
translated_content = r.text
with open(path_to_output_file, "w") as fh:
fh.write(translated_content)

logger.info(
f"Translations downloaded and written to file (resource: {self.config.resource_slug})"
)
logger.info(f"Translations '{language_code}' downloaded")
return str(path_to_output_file)
Loading