Closed JarbasAl closed 1 month ago
[!CAUTION]
Review failed
The pull request is closed.
A new GitHub Actions workflow named sync_tx.yml
has been added to automate the synchronization of translation files. This workflow triggers on pushes to the dev
branch and can also be manually dispatched. Additionally, several JSON files containing translations in multiple languages (English and French) have been created for the Open Voice OS installation process, along with minor textual corrections and formatting adjustments in various localization scripts.
File Path | Change Summary |
---|---|
.github/workflows/sync_tx.yml | New workflow added to automate synchronization of translation files on push and manual dispatch. |
translations/en-us/strings.json | New English translations for installation scripts added. |
translations/fr-fr/strings.json | New French translations for installation scripts added. |
tui/locales/en-us/summary.sh | Minor formatting changes for summary output in English. |
tui/locales/fr-fr/channels.sh | Textual corrections in French localization. |
tui/locales/fr-fr/features.sh | Textual modifications for clarity in French localization. |
tui/locales/fr-fr/finish.sh | Punctuation adjustments in French text. |
tui/locales/fr-fr/methods.sh | Formatting changes for consistency in French text. |
tui/locales/fr-fr/summary.sh | Formatting adjustments for summary message in French. |
tui/locales/fr-fr/telemetry.sh | Minor textual modifications for clarity in French localization. |
tui/locales/fr-fr/tuning.sh | Minor formatting change in French text. |
tui/locales/fr-fr/uninstall.sh | Formatting adjustments in French prompts related to uninstallation. |
sync_tx.yml
workflow file that is present in the main PR, indicating a direct connection in the automation of translation file synchronization.🐇 In the meadow where translations bloom,
New scripts and workflows dispel the gloom.
From English to French, each phrase takes flight,
Guiding users with words, clear and bright.
With every push, our voices unite,
Celebrating changes, oh what a delight! 🌼
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
for reference, this was the quick script to parse locale files
import json
import os
from os.path import dirname
FILES = ['misc.sh', 'channels.sh', 'detection.sh', 'features.sh',
'finish.sh', 'methods.sh', 'profiles.sh', 'satellite.sh',
'summary.sh', 'telemetry.sh', 'tuning.sh', 'uninstall.sh',
'welcome.sh']
TRANSLATIONS_FOLDER = f"{dirname(dirname(__file__))}/translations"
LOCALE_FOLDER = f"{dirname(dirname(__file__))}/tui/locales"
def get_key(k, lines, f):
in_k = False
val = ""
for l in lines:
if l.strip().startswith("#"):
continue # comment
if f == "satellite.sh" and k == "content" and 'content="' in l:
in_k = True
elif l.strip() == '"':
in_k = False
elif l.startswith("export "):
in_k = False
elif l.startswith(f"{k.upper()}="):
in_k = True
elif '="' in l:
in_k = False
if in_k:
if f == "satellite.sh" and l.strip() == "$content":
continue
l = l.split('="')[-1]
if l.endswith('"'):
l = l[:-1]
val += f"\n{l}"
return val.strip()
def get_locale(lang):
DATA = {}
for f in FILES:
try:
with open(f"{LOCALE_FOLDER}/{lang}/{f}", "r") as fi:
lines = fi.read().split("\n")
except:
print(f"missing file: {lang}/{f}")
continue
# print(lang, data)
if f == "satellite.sh":
DATA[f] = {
"title_host": get_key("title_host", lines, f),
"title_port": get_key("title_port", lines, f),
"title_key": get_key("title_key", lines, f),
"title_password": get_key("title_password", lines, f),
"content": get_key("content", lines, f),
"content_host": get_key("content_host", lines, f),
"content_port": get_key("content_port", lines, f),
"content_key": get_key("content_key", lines, f),
"content_password": get_key("content_password", lines, f),
}
elif f == "features.sh":
DATA[f] = {
"title": get_key("title", lines, f),
"content": get_key("content", lines, f),
"skill_description": get_key("skill_description", lines, f),
"extra_skill_description": get_key("extra_skill_description", lines, f),
"gui_description": get_key("gui_description", lines, f)
}
elif f == "misc.sh":
DATA[f] = {
"ok_button": get_key("ok_button", lines, f),
"yes_button": get_key("yes_button", lines, f),
"no_button": get_key("no_button", lines, f),
"back_button": get_key("back_button", lines, f),
}
else:
DATA[f] = {
"title": get_key("title", lines, f),
"content": get_key("content", lines, f),
}
return DATA
for lang in os.listdir(LOCALE_FOLDER):
data = get_locale(lang)
print(lang, data)
for f in FILES:
os.makedirs(f"{TRANSLATIONS_FOLDER}/{lang}", exist_ok=True)
with open(f"{TRANSLATIONS_FOLDER}/{lang}/strings.json", "w") as f:
json.dump(data, f, indent=2, ensure_ascii=False)
adds support for integrating with Gitlocalize
whenever a PR from gitlocalize bot is merged the sync_translations.py script will run and update the
locale
folder with user submitted strings from GitLocalize platformalso closes #160 (typo)
the script has been run to validate it didnt mess the files, please check the minor formatting changes caused by the script
Summary by CodeRabbit
New Features
Bug Fixes