From 1e433d21f4325f3809fe897a35780e7d7dae0fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Trimaille?= Date: Thu, 7 Dec 2023 16:53:55 +0100 Subject: [PATCH] Review logging about downloading transifex files (#258) * Review logging about downloading transifex files * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- qgispluginci/translation.py | 6 ++++-- qgispluginci/translation_clients/transifex.py | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/qgispluginci/translation.py b/qgispluginci/translation.py index 686cf9a5..80c123dd 100644 --- a/qgispluginci/translation.py +++ b/qgispluginci/translation.py @@ -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}" diff --git a/qgispluginci/translation_clients/transifex.py b/qgispluginci/translation_clients/transifex.py index 8252d457..1de320f5 100644 --- a/qgispluginci/translation_clients/transifex.py +++ b/qgispluginci/translation_clients/transifex.py @@ -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)