From c65940e30d2ebe9e11155c74a6e5b711a211f15e Mon Sep 17 00:00:00 2001 From: Eugene Fryntov Date: Tue, 21 Jan 2025 16:23:18 -0500 Subject: [PATCH 1/3] [Android] build: fail assembly on translation format issues --- android/app/build.gradle | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index 3c79443..a2c1851 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -155,6 +155,18 @@ android { buildFeatures { aidl true } + + lintOptions { + // Make translation issues fatal + fatal 'StringFormatInvalid', 'StringFormatMatches' + } +} + +// Perform lint checks before any assemble task +tasks.configureEach { task -> + if (task.name.contains("assemble")) { + task.dependsOn 'lint' + } } // Apply static values from `gradle.properties` to the `android.packagingOptions` From 88778607b4f08852c1ed9ce0c6a778123fdd762d Mon Sep 17 00:00:00 2001 From: Eugene Fryntov Date: Tue, 21 Jan 2025 19:35:23 -0500 Subject: [PATCH 2/3] Pull Transifex translations and remove obsolete Android pt-rPT resources --- .../app/src/main/res/values-fa/strings.xml | 11 +++----- .../src/main/res/values-pt-rPT/strings.xml | 26 ------------------- src/i18n/locales/fa/translation.json | 6 ++--- 3 files changed, 6 insertions(+), 37 deletions(-) delete mode 100644 android/app/src/main/res/values-pt-rPT/strings.xml diff --git a/android/app/src/main/res/values-fa/strings.xml b/android/app/src/main/res/values-fa/strings.xml index 89a1766..8e1889f 100644 --- a/android/app/src/main/res/values-fa/strings.xml +++ b/android/app/src/main/res/values-fa/strings.xml @@ -1,14 +1,11 @@ Conduit - contain - false - automatic توقف - ۱\n۲\n۳ + %1$d / %2$d \u00B7 %3$s - اتصال فعال %1$d\nدر حال اتصال %2$d\nانتقال داده شد %3$s + اتصال فعال %1$d / در حال اتصال %2$d\nانتقال داده شد %3$s منتظر اتصال به شبکه @@ -21,6 +18,4 @@ Conduit راه نیفتاد. برای اطلاعات بیشتر اینجا کلیک کنید. Conduit در حال شروع است... - - true - + diff --git a/android/app/src/main/res/values-pt-rPT/strings.xml b/android/app/src/main/res/values-pt-rPT/strings.xml deleted file mode 100644 index 3eabdd9..0000000 --- a/android/app/src/main/res/values-pt-rPT/strings.xml +++ /dev/null @@ -1,26 +0,0 @@ - - Conduit - contain - false - automatic - - Parar - - %1$d / %2$d \u00B7 %3$s - - Clientes: %1$d ligados / %2$d a ligar\nDados: %3$s transferidos - - A aguardar conetividade da rede - - Notificação para o serviço Conduit - - Atualização necessária: Descarregue a versão mais recente da aplicação para que a possa continuar a utilizar. - - Falha no arranque do serviço Conduit. Toque na notificação para obter mais informações - - Falha ao reiniciar o serviço. Toque na notificação para obter mais informações - - O serviço Conduit está a iniciar... - - true - diff --git a/src/i18n/locales/fa/translation.json b/src/i18n/locales/fa/translation.json index 641b11c..c1a06ec 100644 --- a/src/i18n/locales/fa/translation.json +++ b/src/i18n/locales/fa/translation.json @@ -12,13 +12,13 @@ "developer_comment": "Text displayed to the user to indicate their Conduit ID. The name 'Conduit' is the app name and should not be translated." }, "TOTAL_BYTES_TRANSFERRED_I18N": { - "string": "منتقل شده {{ niceBytes }}" + "string": "{{ niceBytes }} منتقل شده" }, "CONNECTED_PEERS_I18N": { - "string": "کاربران متصل {{ peers }}" + "string": "{{ peers }} کاربران متصل" }, "CONNECTING_PEERS_I18N": { - "string": "در حال اتصال {{ peers }}" + "string": "{{ peers }} در حال اتصال" }, "CANCEL_I18N": { "string": "لغو کنید" From 94156c6fce74c444374e2b363273191ee948b42f Mon Sep 17 00:00:00 2001 From: Eugene Fryntov Date: Tue, 21 Jan 2025 19:50:43 -0500 Subject: [PATCH 3/3] i18n: add README with translation pull and verification workflow --- README.md | 4 ++++ i18n/README.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 i18n/README.md diff --git a/README.md b/README.md index 5191ca1..c4bb20c 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,7 @@ For more information about Conduit, [visit the web site](https://conduit.psiphon This project uses [Git LFS](https://git-lfs.github.com/) to manage large files such as the tunnel core libraries. +## Translations + +For information about pulling and verifying translations, see [i18n/README.md](i18n/README.md). + diff --git a/i18n/README.md b/i18n/README.md new file mode 100644 index 0000000..3af7a95 --- /dev/null +++ b/i18n/README.md @@ -0,0 +1,29 @@ +# i18n + +⚠️ **Important Notes:** +- Lint checks only verify Android translations +- React Native (Conduit core) translations are not verified + +## Setup +1. Create `transifex_api_token` file in this directory (this file is gitignored) +2. Place your Transifex API token in this file + +## Workflow Steps + +1. Pull translations: +```bash +uv run transifex_pull.py +``` + +2. Check translation quality: +```bash +cd ../android +./gradlew lint +``` + +3. If lint fails: + - Fix or delete problematic translations + - Rerun lint until it passes + - Then try building the app + +4. If all checks pass, commit the changes \ No newline at end of file