🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update translation workflow to specify JSON file patterns for adding translations and remove unused translation scripts, streamlining the translation process.
Bill Yang3fb061944a58
diff --git a/.github/workflows/translate-docs.yml b/.github/workflows/translate-docs.ymlindex 47b02cdfb..077929683 100644--- a/.github/workflows/translate-docs.yml+++ b/.github/workflows/translate-docs.yml@@ -113,9 +113,10 @@ jobs:- Maintain consistent terminology within each language file- Do NOT modify en.json- If there are no missing translations, do nothing+ - You may use python3 to read/analyze/update the JSON filesAfter translating, commit and push directly to master using these exact steps (run each command separately, use only single-line messages with no newlines):- 1. git add docs/messages/+ 1. git add docs/messages/*.json2. git commit -m "Update docs translations"3. git push origin masterclaude_args: >-diff --git a/.github/workflows/translate.yml b/.github/workflows/translate.ymlindex 2744525a0..7e85e95a8 100644--- a/.github/workflows/translate.yml+++ b/.github/workflows/translate.yml@@ -113,9 +113,10 @@ jobs:- Maintain consistent terminology within each language file- Do NOT modify en.json- If there are no missing translations, do nothing+ - You may use python3 to read/analyze/update the JSON filesAfter translating, commit and push directly to master using these exact steps (run each command separately, use only single-line messages with no newlines):- 1. git add client/messages/+ 1. git add client/messages/*.json2. git commit -m "Update translations"3. git push origin masterclaude_args: >-diff --git a/client/messages/check_translations.py b/client/messages/check_translations.pydeleted file mode 100644index 32e1e43df..000000000--- a/client/messages/check_translations.py+++ /dev/null@@ -1,22 +0,0 @@-import json--with open('en.json') as f:- en = json.load(f)--files = ['zh.json', 'ja.json', 'de.json', 'pl.json', 'pt.json', 'it.json', 'fr.json', 'ko.json', 'es.json']--for fname in files:- with open(fname) as f:- trans = json.load(f)-- empty = [k for k, v in trans.items() if v == '']- stale = [k for k in trans if k not in en]- missing = [k for k in en if k not in trans]- english = [k for k, v in trans.items() if k in en and v == en[k] and v != '']-- print(f'{fname}:')- print(f' Empty strings: {empty}')- print(f' Stale keys: {stale}')- print(f' Missing keys: {missing}')- print(f' Still English (same as en.json): {english}')- print()diff --git a/client/messages/update_translations.py b/client/messages/update_translations.pydeleted file mode 100644index a117cf564..000000000--- a/client/messages/update_translations.py+++ /dev/null@@ -1,96 +0,0 @@-import json-import re--# Translations for the 4 empty keys-translations = {- 'zh.json': {- 'rd5F5r': '自定义计划',- '5/hIKX': '计划限制',- 'BdV5Om': '网站',- 'HCYBYT': '团队成员',- },- 'ja.json': {- 'rd5F5r': 'カスタムプラン',- '5/hIKX': 'プランの制限',- 'BdV5Om': 'ウェブサイト',- 'HCYBYT': 'チームメンバー',- 'u9xEkD': '© {year} Rybbit. 全著作権所有。',- },- 'de.json': {- 'rd5F5r': 'Benutzerdefinierter Plan',- '5/hIKX': 'Plan-Limits',- 'BdV5Om': 'Websites',- 'HCYBYT': 'Teammitglieder',- },- 'pl.json': {- 'rd5F5r': 'Plan niestandardowy',- '5/hIKX': 'Limity planu',- 'BdV5Om': 'Strony internetowe',- 'HCYBYT': 'Członkowie zespołu',- },- 'pt.json': {- 'rd5F5r': 'Plano personalizado',- '5/hIKX': 'Limites do plano',- 'BdV5Om': 'Sites',- 'HCYBYT': 'Membros da equipe',- },- 'it.json': {- 'rd5F5r': 'Piano personalizzato',- '5/hIKX': 'Limiti del piano',- 'BdV5Om': 'Siti web',- 'HCYBYT': 'Membri del team',- },- 'fr.json': {- 'rd5F5r': 'Plan personnalisé',- '5/hIKX': 'Limites du plan',- 'BdV5Om': 'Sites web',- 'HCYBYT': "Membres de l'équipe",- },- 'ko.json': {- 'rd5F5r': '맞춤 플랜',- '5/hIKX': '플랜 한도',- 'BdV5Om': '웹사이트',- 'HCYBYT': '팀 멤버',- 'u9xEkD': '© {year} Rybbit. 모든 권리 보유.',- },- 'es.json': {- 'rd5F5r': 'Plan personalizado',- '5/hIKX': 'Límites del plan',- 'BdV5Om': 'Sitios web',- 'HCYBYT': 'Miembros del equipo',- },-}--# Load en.json as key order reference-with open('en.json', 'r', encoding='utf-8') as f:- en_content = f.read()- en = json.loads(en_content)--en_key_order = list(en.keys())--for fname, updates in translations.items():- with open(fname, 'r', encoding='utf-8') as f:- data = json.load(f)-- # Apply updates- for key, value in updates.items():- if key in data:- data[key] = value-- # Reorder keys to match en.json order- ordered = {}- for key in en_key_order:- if key in data:- ordered[key] = data[key]- # Add any extra keys not in en.json (shouldn't happen, but just in case)- for key in data:- if key not in ordered:- ordered[key] = data[key]-- with open(fname, 'w', encoding='utf-8') as f:- json.dump(ordered, f, ensure_ascii=False, indent=2)- f.write('\n')-- print(f'Updated {fname}')--print('Done!')