From bd17de94e98debd484ca34a5c3283a2152a8888e Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Mon, 20 Feb 2023 10:53:47 +0100 Subject: [PATCH] lang sync + new transifex API compatible tool to sync translations --- localization/rssguard_en_US.ts | 4 +- localization/rssguard_es.ts | 27 +++++----- localization/rssguard_pt_BR.ts | 7 +-- localization/rssguard_zh_TW.ts | 61 ++++++++++++----------- resources/scripts/update-localizations.py | 45 +++++++++++++++++ resources/scripts/update-localizations.sh | 23 --------- 6 files changed, 97 insertions(+), 70 deletions(-) create mode 100755 resources/scripts/update-localizations.py delete mode 100755 resources/scripts/update-localizations.sh diff --git a/localization/rssguard_en_US.ts b/localization/rssguard_en_US.ts index c2510fefa..49935ae18 100644 --- a/localization/rssguard_en_US.ts +++ b/localization/rssguard_en_US.ts @@ -5458,7 +5458,9 @@ File filter for external e-mail selection dialog. Placeholders: • %1 - title of selected message, • %2 - body of selected message. - + Placeholders: + • %1 - title of selected message, + • %2 - body of selected message. diff --git a/localization/rssguard_es.ts b/localization/rssguard_es.ts index c21149f4b..d4fedd19a 100644 --- a/localization/rssguard_es.ts +++ b/localization/rssguard_es.ts @@ -134,7 +134,7 @@ Error: %1 Output directory is not writable. - La carpeta de salida catrece de permisos de escritura. + La carpeta de salida carece de permisos de escritura. @@ -149,7 +149,7 @@ Error: %1 Settings restoration was not initiated. Make sure that output directory is writable. - La restauración de la configuración no fue iniciada. Verifique que la carpeta de salida tiene permisos de escritura. + Fue imposible iniciar la restauración de la configuración. Verifique que la carpeta de salida tiene permisos de escritura. @@ -255,7 +255,7 @@ versión pulsando en esta notificación emergente. Username is ok or it is not needed. - El nombre de usuario es válido o no se necesita. + El nombre de usuario es válido o innecesario. @@ -265,7 +265,7 @@ versión pulsando en esta notificación emergente. Password is ok or it is not needed. - La contraseña es válida o no se necesita. + La contraseña es válida o innecesaria. @@ -365,7 +365,7 @@ versión pulsando en esta notificación emergente. Given account does not support adding feeds. - La cuenta no admite añadir fuentes. + La cuenta proporcionada carece de soporte para añadir fuentes. @@ -375,12 +375,12 @@ versión pulsando en esta notificación emergente. This website does not contain any feeds - Este sitio web no contiene fuentes + Este sitio web carece de fuentes Add one of %n feed(s) - Añadir uno de %n fuenteAñadir uno de %n fuentesAñadir uno de %n fuente(s) + Añadir uno de %n fuente(s)Añadir uno de %n fuente(s)Añadir uno de %n fuente(s) @@ -620,7 +620,7 @@ Pulse aquí para abrir la carpeta principal. Reply-to - Responder A + Responder a @@ -668,13 +668,13 @@ Estado: %3 uses global settings (%n minute(s) to next auto-fetch of articles) - utiliza la configuración global (%n en minuto) para la próxima obtención automática de artículos)utiliza la configuración global (%n en minutos) para la próxima obtención automática de artículos)utiliza la configuración global (%n en minutos) para la próxima obtención automática de artículos) + utiliza la configuración global (%n minuto(s) para la próxima obtención automática de artículos)utiliza la configuración global (%n en minuto(s) para la próxima obtención automática de artículos)utiliza la configuración global (%n en minuto(s) para la próxima obtención automática de artículos) uses specific settings (%n minute(s) to next auto-fetching of new articles) Describes feed auto-update status. - usa configuraciones específicas (% minuto) para la próxima búsqueda automática de nuevos artículos)usa configuraciones específicas (%n minutos) para la próxima búsqueda automática de nuevos artículos)usa configuraciones específicas (%n minutos) para la próxima búsqueda automática de nuevos artículos) + usa configuraciones específicas (% minuto) para la próxima búsqueda automática de nuevos artículos)usa configuraciones específicas (%n minuto(s) para la próxima búsqueda automática de nuevos artículos)usa configuraciones específicas (%n minuto(s) para la próxima búsqueda automática de nuevos artículos) @@ -5308,7 +5308,8 @@ Expiración de testigos de ingreso: %2 Number of feeds: %1 Number of categories: %2 - + Número de fuentes: %1 +Número de categorías: %2 @@ -5398,7 +5399,7 @@ File filter for external e-mail selection dialog. Disable cache - + Desactivar caché @@ -7140,7 +7141,7 @@ Noticias sin leer: %2 If you select intelligent synchronization, then only not-yet-fetched or updated articles are downloaded. Network usage is greatly reduced and overall synchronization speed is greatly improved, but first feed fetching could be slow anyway if your feed contains huge number of articles.<br/><br/>Also, make sure to install <a href="https://www.google.com">api_newsplus</a> TT-RSS plugin to your server instance. - + Si selecciona la sincronización inteligente, sólo se descargarán los artículos actualizados o que aún no se hayan obtenido. El uso de la red se reduce considerablemente y la velocidad de sincronización general mejora considerablemente, pero la obtención de la primera fuente podría ser lenta de todos modos si su fuente contiene una gran cantidad de artículos.<br/><br/>También, asegúrese de instalar el complemento TT-RSS<a href="https://www.google.com">api_newsplus</a> en la instancia de su servidor. diff --git a/localization/rssguard_pt_BR.ts b/localization/rssguard_pt_BR.ts index b153096b8..9f193caa6 100644 --- a/localization/rssguard_pt_BR.ts +++ b/localization/rssguard_pt_BR.ts @@ -5309,7 +5309,8 @@ Expiração dos tokens de login: %2 Number of feeds: %1 Number of categories: %2 - + Número de feeds: %1 +Número de categorias: %2 @@ -5399,7 +5400,7 @@ File filter for external e-mail selection dialog. Disable cache - + Desativar cache @@ -7139,7 +7140,7 @@ Notícias não lidas: %2 If you select intelligent synchronization, then only not-yet-fetched or updated articles are downloaded. Network usage is greatly reduced and overall synchronization speed is greatly improved, but first feed fetching could be slow anyway if your feed contains huge number of articles.<br/><br/>Also, make sure to install <a href="https://www.google.com">api_newsplus</a> TT-RSS plugin to your server instance. - + Se você selecionar a sincronização inteligente, apenas os artigos ainda não buscados ou atualizados serão baixados. O uso da rede é muito reduzido e a velocidade geral de sincronização é muito melhorada, mas a busca do primeiro feed pode ser lenta de qualquer maneira se o seu feed contiver um grande número de artigos.<br/><br/>Também, certifique-se de instalar o plugin TT-RSS <a href="https://www.google.com">api_newsplus</a> em sua instância do servidor. diff --git a/localization/rssguard_zh_TW.ts b/localization/rssguard_zh_TW.ts index bcb5d15f6..86aa26cf5 100644 --- a/localization/rssguard_zh_TW.ts +++ b/localization/rssguard_zh_TW.ts @@ -78,7 +78,7 @@ Error: %1 Filter lists - 篩選器清單 + 篩選規則清單 @@ -88,7 +88,7 @@ Error: %1 Custom filters - 自訂篩選器 + 自訂篩選規則 @@ -114,7 +114,7 @@ Error: %1 Failed to setup filters and start server: %1. - + 無法建立篩選規則,並啟動伺服器: %1。 @@ -631,7 +631,7 @@ Click here to open parent directory. uses global settings, but global auto-fetching of articles is disabled - + 使用全局設定,但停用全局自動下載文章 @@ -654,7 +654,7 @@ Click here to open parent directory. Active message filters: %2 Status: %3 自動更新之狀態: %1 -使用中的篩選器: %2 +使用中的篩選規則: %2 狀態: %3 @@ -1374,7 +1374,7 @@ or this functionality is not implemented yet. Images (%1) - + 圖片(%1) @@ -1689,7 +1689,7 @@ or this functionality is not implemented yet. Ignore notifications for this feed - + 忽略此文元的通知 @@ -1697,7 +1697,7 @@ or this functionality is not implemented yet. Application log - + 應用程式的記錄 @@ -2286,7 +2286,7 @@ or this functionality is not implemented yet. Display application &log - + 顯示應用程式的記錄(&L) @@ -2383,7 +2383,7 @@ or this functionality is not implemented yet. Cannot save new filter, error: '%1'. - 無法儲存新篩選器,錯誤: '%1'。 + 無法儲存新篩選規則,錯誤: '%1'。 @@ -2448,7 +2448,7 @@ or this functionality is not implemented yet. Do you really want to remove selected filter? - 真要移除所選篩選方式嗎? + 真要移除所選篩選規則嗎? @@ -2473,7 +2473,7 @@ or this functionality is not implemented yet. &New filter - 新增篩選器(&N) + 新增篩選規則(&N) @@ -2494,7 +2494,7 @@ or this functionality is not implemented yet. Pre-made filters - + 預製的篩選規則 @@ -2752,7 +2752,7 @@ You have to restart manually. Some feeds were not loaded properly or import file is corrupted. - + 有些文源無法適當載入,或匯入的檔案有毀損。 @@ -2827,7 +2827,7 @@ You have to restart manually. OPML 2.0 files (*.opml *.xml) - + OPML 2.0 檔 (*.opml *.xml) @@ -2858,12 +2858,12 @@ You have to restart manually. Fetch online metadata - + 取得線上屬性資料 Optional post-processing script - + 可選用的後續處理隨譯即行碼 @@ -3956,7 +3956,7 @@ Login tokens expiration: %2 Assigned labels - + 配定的標籤 @@ -4046,7 +4046,7 @@ Login tokens expiration: %2 Labels assigned to the article. - + 配定給文章的標籤 @@ -4936,12 +4936,12 @@ List of supported readers: interesting stuff - 有趣的項目 + 有興趣的項目 interesting stuff (highlighted) - 有趣的項目(標示) + 有興趣的項目(標示) @@ -4956,12 +4956,12 @@ List of supported readers: items with new articles - + 有新文章的項目 items with new articles (highlighted) - + 有新文章的項目(標示) @@ -5301,7 +5301,8 @@ Login tokens expiration: %2 Number of feeds: %1 Number of categories: %2 - + 文源數: %1 +分類數: %2 @@ -5376,22 +5377,22 @@ File filter for external e-mail selection dialog. Enable HTTP/2 - + 啟用 HTTP/2 WebEngine - + 網頁呈現引擎(WebEngine) Custom "QTWEBENGINE_CHROMIUM_FLAGS" flags - + 自訂 "QTWEBENGINE_CHROMIUM_FLAGS" 旗標 Disable cache - + 停用快取 @@ -6651,7 +6652,7 @@ Type: %3 Images (%1) - + 圖片(%1) @@ -7130,7 +7131,7 @@ Unread news: %2 If you select intelligent synchronization, then only not-yet-fetched or updated articles are downloaded. Network usage is greatly reduced and overall synchronization speed is greatly improved, but first feed fetching could be slow anyway if your feed contains huge number of articles.<br/><br/>Also, make sure to install <a href="https://www.google.com">api_newsplus</a> TT-RSS plugin to your server instance. - + 若選智慧同步,就只下載尚未下載或更新的文章。會大幅降低網路用量,提升整體同步速度。不過第一次下載可能會很慢,如果文源含有大量文章的話。<br/><br/>同時,請確認有安裝<a href="https://www.google.com">api_newsplus</a> TT-RSS 掛件到伺服器的實例。 diff --git a/resources/scripts/update-localizations.py b/resources/scripts/update-localizations.py new file mode 100755 index 000000000..3d3a78219 --- /dev/null +++ b/resources/scripts/update-localizations.py @@ -0,0 +1,45 @@ +# Setup parameters. +#RESOURCE = "./localization/rssguard_en.ts" +#CODES = "cs da de en_GB en_US es fi fr gl he id it ja lt nl pl pt_BR pt_PT ru sv uk zh_CN zh_TW" +#TRANSLATION = './localization/rssguard_$CODE.ts' + + +import sys +import os +import urllib + +from transifex.api import transifex_api +from pprint import pprint + +# Read API token. +api_token = sys.argv[1] + +print("API token: {}".format(api_token)) + +transifex_api.setup(auth = api_token) + +# Constants. +org_slug = "martinrotter" +proj_slug = "rssguard" +translation_file = os.path.normpath("./localization/rssguard_{}.ts") + +# Organization/project. +organization = transifex_api.Organization.get(slug = org_slug) +project = organization.fetch('projects').get(slug = proj_slug) +resource = project.fetch('resources').get(slug = proj_slug) +languages = project.fetch('languages') + +# Upload resource file. +with open(translation_file.format("en"), "r", encoding = "utf-8") as file: + print("Uploading resource...") + + resource_data = file.read() + transifex_api.ResourceStringsAsyncUpload.upload(resource_data, resource = resource) + +# Download translations. +for lang in languages: + print("Downloading {} translation...".format(lang.code)) + + url = transifex_api.ResourceTranslationsAsyncDownload.download(resource = resource, language = lang) + target_path = translation_file.format(lang.code) + urllib.request.urlretrieve(url, target_path) \ No newline at end of file diff --git a/resources/scripts/update-localizations.sh b/resources/scripts/update-localizations.sh deleted file mode 100755 index 57094294b..000000000 --- a/resources/scripts/update-localizations.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Transka executable. -TRANSKA="$(dirname "$0")/transka/transka" - -# Get credentials. -read -e -p "Username: " -i "martinrotter" USERNAME -read -p "Password: " PASSWORD - -# Setup parameters. -RESOURCE="./localization/rssguard_en.ts" -CODES="cs da de en_GB en_US es fi fr gl he id it ja lt nl pl pt_BR pt_PT ru sv uk zh_CN zh_TW" -TRANSLATION='./localization/rssguard_$CODE.ts' - -declare PARAMS - -PARAMS+="-u "$USERNAME" -p "$PASSWORD" -ps "rssguard" -rs "rssguard" -ur "$RESOURCE" " - -for CODE in $CODES; do - PARAMS+="-dt "$CODE" "$(eval echo $TRANSLATION)" " -done - -$TRANSKA $PARAMS \ No newline at end of file