From 1d6059e94603aaf08c8e3415d84c2889a33c397c Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Mon, 2 Dec 2024 01:27:43 +0000 Subject: [PATCH] import galician translations (#61) --- locale/gl-es/ca.voc | 2 + locale/gl-es/de.voc | 1 + locale/gl-es/en-au.voc | 2 + locale/gl-es/en-ca.voc | 2 + locale/gl-es/en-gb.voc | 3 ++ locale/gl-es/en-us.voc | 3 ++ locale/gl-es/en.voc | 1 + locale/gl-es/es.voc | 1 + locale/gl-es/euro.voc | 2 + locale/gl-es/euronews.voc | 1 + locale/gl-es/fi.voc | 2 + locale/gl-es/fr.voc | 2 + locale/gl-es/fr24.voc | 4 ++ locale/gl-es/intro.dialog | 1 + locale/gl-es/it.voc | 2 + locale/gl-es/news.voc | 1 + locale/gl-es/nl.voc | 2 + locale/gl-es/pt-pt.voc | 2 + locale/gl-es/rt.voc | 1 + locale/gl-es/ru.voc | 2 + locale/gl-es/sv.voc | 2 + locale/gl-es/video.voc | 1 + scripts/bump_alpha.py | 18 ------- scripts/bump_build.py | 21 --------- scripts/bump_major.py | 27 ----------- scripts/bump_minor.py | 24 ---------- scripts/prepare_skillstore.py | 76 ----------------------------- scripts/prepare_translations.py | 53 --------------------- scripts/translate.py | 48 ------------------- translations/gl-es/dialogs.json | 5 ++ translations/gl-es/vocabs.json | 84 +++++++++++++++++++++++++++++++++ 31 files changed, 129 insertions(+), 267 deletions(-) create mode 100644 locale/gl-es/ca.voc create mode 100644 locale/gl-es/de.voc create mode 100644 locale/gl-es/en-au.voc create mode 100644 locale/gl-es/en-ca.voc create mode 100644 locale/gl-es/en-gb.voc create mode 100644 locale/gl-es/en-us.voc create mode 100644 locale/gl-es/en.voc create mode 100644 locale/gl-es/es.voc create mode 100644 locale/gl-es/euro.voc create mode 100644 locale/gl-es/euronews.voc create mode 100644 locale/gl-es/fi.voc create mode 100644 locale/gl-es/fr.voc create mode 100644 locale/gl-es/fr24.voc create mode 100644 locale/gl-es/intro.dialog create mode 100644 locale/gl-es/it.voc create mode 100644 locale/gl-es/news.voc create mode 100644 locale/gl-es/nl.voc create mode 100644 locale/gl-es/pt-pt.voc create mode 100644 locale/gl-es/rt.voc create mode 100644 locale/gl-es/ru.voc create mode 100644 locale/gl-es/sv.voc create mode 100644 locale/gl-es/video.voc delete mode 100644 scripts/bump_alpha.py delete mode 100644 scripts/bump_build.py delete mode 100644 scripts/bump_major.py delete mode 100644 scripts/bump_minor.py delete mode 100644 scripts/prepare_skillstore.py delete mode 100644 scripts/prepare_translations.py delete mode 100644 scripts/translate.py create mode 100644 translations/gl-es/dialogs.json create mode 100644 translations/gl-es/vocabs.json diff --git a/locale/gl-es/ca.voc b/locale/gl-es/ca.voc new file mode 100644 index 0000000..2f8a4be --- /dev/null +++ b/locale/gl-es/ca.voc @@ -0,0 +1,2 @@ +Cataluña +catalán \ No newline at end of file diff --git a/locale/gl-es/de.voc b/locale/gl-es/de.voc new file mode 100644 index 0000000..f356e64 --- /dev/null +++ b/locale/gl-es/de.voc @@ -0,0 +1 @@ +alemán \ No newline at end of file diff --git a/locale/gl-es/en-au.voc b/locale/gl-es/en-au.voc new file mode 100644 index 0000000..8c0e874 --- /dev/null +++ b/locale/gl-es/en-au.voc @@ -0,0 +1,2 @@ +australia +australiano \ No newline at end of file diff --git a/locale/gl-es/en-ca.voc b/locale/gl-es/en-ca.voc new file mode 100644 index 0000000..5fee54b --- /dev/null +++ b/locale/gl-es/en-ca.voc @@ -0,0 +1,2 @@ +canadense +canadá \ No newline at end of file diff --git a/locale/gl-es/en-gb.voc b/locale/gl-es/en-gb.voc new file mode 100644 index 0000000..ac102f0 --- /dev/null +++ b/locale/gl-es/en-gb.voc @@ -0,0 +1,3 @@ +Reino Unido +británico +reino unido \ No newline at end of file diff --git a/locale/gl-es/en-us.voc b/locale/gl-es/en-us.voc new file mode 100644 index 0000000..a023c66 --- /dev/null +++ b/locale/gl-es/en-us.voc @@ -0,0 +1,3 @@ +américa +estados unidos +estadounidense \ No newline at end of file diff --git a/locale/gl-es/en.voc b/locale/gl-es/en.voc new file mode 100644 index 0000000..41e3203 --- /dev/null +++ b/locale/gl-es/en.voc @@ -0,0 +1 @@ +inglés \ No newline at end of file diff --git a/locale/gl-es/es.voc b/locale/gl-es/es.voc new file mode 100644 index 0000000..830978d --- /dev/null +++ b/locale/gl-es/es.voc @@ -0,0 +1 @@ +español \ No newline at end of file diff --git a/locale/gl-es/euro.voc b/locale/gl-es/euro.voc new file mode 100644 index 0000000..44d5451 --- /dev/null +++ b/locale/gl-es/euro.voc @@ -0,0 +1,2 @@ +euro +europeo \ No newline at end of file diff --git a/locale/gl-es/euronews.voc b/locale/gl-es/euronews.voc new file mode 100644 index 0000000..d899aa5 --- /dev/null +++ b/locale/gl-es/euronews.voc @@ -0,0 +1 @@ +euronews \ No newline at end of file diff --git a/locale/gl-es/fi.voc b/locale/gl-es/fi.voc new file mode 100644 index 0000000..b07dab1 --- /dev/null +++ b/locale/gl-es/fi.voc @@ -0,0 +1,2 @@ +finlandia +finés \ No newline at end of file diff --git a/locale/gl-es/fr.voc b/locale/gl-es/fr.voc new file mode 100644 index 0000000..47f3fb0 --- /dev/null +++ b/locale/gl-es/fr.voc @@ -0,0 +1,2 @@ +francia +francés \ No newline at end of file diff --git a/locale/gl-es/fr24.voc b/locale/gl-es/fr24.voc new file mode 100644 index 0000000..2a619df --- /dev/null +++ b/locale/gl-es/fr24.voc @@ -0,0 +1,4 @@ +France 24 +France vintecatro +France vixésimo cuarto +France24 \ No newline at end of file diff --git a/locale/gl-es/intro.dialog b/locale/gl-es/intro.dialog new file mode 100644 index 0000000..04e3e6b --- /dev/null +++ b/locale/gl-es/intro.dialog @@ -0,0 +1 @@ +Grazas por instalares News Skill \ No newline at end of file diff --git a/locale/gl-es/it.voc b/locale/gl-es/it.voc new file mode 100644 index 0000000..2dc9f5b --- /dev/null +++ b/locale/gl-es/it.voc @@ -0,0 +1,2 @@ +Italia +italiano \ No newline at end of file diff --git a/locale/gl-es/news.voc b/locale/gl-es/news.voc new file mode 100644 index 0000000..7e05710 --- /dev/null +++ b/locale/gl-es/news.voc @@ -0,0 +1 @@ +novas \ No newline at end of file diff --git a/locale/gl-es/nl.voc b/locale/gl-es/nl.voc new file mode 100644 index 0000000..525ecc8 --- /dev/null +++ b/locale/gl-es/nl.voc @@ -0,0 +1,2 @@ +Países Baixos +neerlandés \ No newline at end of file diff --git a/locale/gl-es/pt-pt.voc b/locale/gl-es/pt-pt.voc new file mode 100644 index 0000000..6d35675 --- /dev/null +++ b/locale/gl-es/pt-pt.voc @@ -0,0 +1,2 @@ +Portugal +portugués \ No newline at end of file diff --git a/locale/gl-es/rt.voc b/locale/gl-es/rt.voc new file mode 100644 index 0000000..8d14eae --- /dev/null +++ b/locale/gl-es/rt.voc @@ -0,0 +1 @@ +Russia Today \ No newline at end of file diff --git a/locale/gl-es/ru.voc b/locale/gl-es/ru.voc new file mode 100644 index 0000000..6b930c6 --- /dev/null +++ b/locale/gl-es/ru.voc @@ -0,0 +1,2 @@ +rusia +ruso \ No newline at end of file diff --git a/locale/gl-es/sv.voc b/locale/gl-es/sv.voc new file mode 100644 index 0000000..a8d8a08 --- /dev/null +++ b/locale/gl-es/sv.voc @@ -0,0 +1,2 @@ +suecia +sueco \ No newline at end of file diff --git a/locale/gl-es/video.voc b/locale/gl-es/video.voc new file mode 100644 index 0000000..fcbdb73 --- /dev/null +++ b/locale/gl-es/video.voc @@ -0,0 +1 @@ +vídeo \ No newline at end of file diff --git a/scripts/bump_alpha.py b/scripts/bump_alpha.py deleted file mode 100644 index e465543..0000000 --- a/scripts/bump_alpha.py +++ /dev/null @@ -1,18 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - else: - print(line.rstrip('\n')) diff --git a/scripts/bump_build.py b/scripts/bump_build.py deleted file mode 100644 index 61099f8..0000000 --- a/scripts/bump_build.py +++ /dev/null @@ -1,21 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) diff --git a/scripts/bump_major.py b/scripts/bump_major.py deleted file mode 100644 index 2610fbb..0000000 --- a/scripts/bump_major.py +++ /dev/null @@ -1,27 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_MAJOR" -minor_var_name = "VERSION_MINOR" -build_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(minor_var_name): - print(f"{minor_var_name} = 0") - elif line.startswith(build_var_name): - print(f"{build_var_name} = 0") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) diff --git a/scripts/bump_minor.py b/scripts/bump_minor.py deleted file mode 100644 index 86dfd9d..0000000 --- a/scripts/bump_minor.py +++ /dev/null @@ -1,24 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_MINOR" -build_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(build_var_name): - print(f"{build_var_name} = 0") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) diff --git a/scripts/prepare_skillstore.py b/scripts/prepare_skillstore.py deleted file mode 100644 index cfeb125..0000000 --- a/scripts/prepare_skillstore.py +++ /dev/null @@ -1,76 +0,0 @@ -from ovos_skills_manager import SkillEntry -from os.path import exists, join, dirname -from shutil import rmtree -import os -from os import makedirs -import json -from ovos_utils.bracket_expansion import expand_parentheses, expand_options - - -branch = "dev" -repo = "skill-ovos-news" -author = "OpenVoiceOS" - -url = f"https://github.com/{author}/{repo}@{branch}" - -skill = SkillEntry.from_github_url(url) -tmp_skills = "/tmp/osm_installed_skills" -skill_folder = f"{tmp_skills}/{skill.uuid}" - -base_dir = dirname(dirname(__file__)) -desktop_dir = join(base_dir, "res", "desktop") -android_ui = join(base_dir, "qt5", "+android") -makedirs(desktop_dir, exist_ok=True) - -readme = join(base_dir, "README.md") -jsonf = join(desktop_dir, "skill.json") -desktopf = join(desktop_dir, f"{repo}.desktop") -skill_code = join(base_dir, "__init__.py") - -res_folder = join(base_dir, "locale", "en-us") - - -def read_samples(path): - samples = [] - with open(path) as fi: - for _ in fi.read().split("\n"): - if _ and not _.strip().startswith("#"): - samples += expand_options(_) - return samples - -samples = [] -for root, folders, files in os.walk(res_folder): - for f in files: - if f.endswith(".intent"): - samples += read_samples(join(root, f)) -skill._data["examples"] = list(set(samples)) - -has_android = exists(android_ui) -with open(skill_code) as f: - has_homescreen = f"{repo}.{author}.home" in f.read() - -if not exists(readme): - with open(readme, "w") as f: - f.write(skill.generate_readme()) - -if has_homescreen and not exists(desktopf): - with open(desktopf, "w") as f: - f.write(skill.desktop_file) - -if not exists(jsonf): - data = skill.json - with open(jsonf, "w") as f: - if not has_android or not has_homescreen: - data.pop("android") - if not has_homescreen: - data.pop("desktop") - data["desktopFile"] = False -else: - with open(jsonf) as f: - data = json.load(f) - -# set dev branch -data["branch"] = "dev" - -with open(jsonf, "w") as f: - json.dump(data, f, indent=4) diff --git a/scripts/prepare_translations.py b/scripts/prepare_translations.py deleted file mode 100644 index 01a674d..0000000 --- a/scripts/prepare_translations.py +++ /dev/null @@ -1,53 +0,0 @@ -"""this script should run every time the contents of the locale folder change -except if PR originated from @gitlocalize-app -TODO - on commit to dev -""" - -import json -from os.path import dirname -import os - -locale = f"{dirname(dirname(__file__))}/locale" -tx = f"{dirname(dirname(__file__))}/translations" - - -for lang in os.listdir(locale): - intents = {} - dialogs = {} - vocs = {} - regexes = {} - for root, _, files in os.walk(f"{locale}/{lang}"): - b = root.split(f"/{lang}")[-1] - - for f in files: - if b: - fid = f"{b}/{f}" - else: - fid = f - with open(f"{root}/{f}") as fi: - strings = [l.replace("{{", "{").replace("}}", "}") - for l in fi.read().split("\n") if l.strip() - and not l.startswith("#")] - - if fid.endswith(".intent"): - intents[fid] = strings - elif fid.endswith(".dialog"): - dialogs[fid] = strings - elif fid.endswith(".voc"): - vocs[fid] = strings - elif fid.endswith(".rx"): - regexes[fid] = strings - - os.makedirs(f"{tx}/{lang.lower()}", exist_ok=True) - if intents: - with open(f"{tx}/{lang.lower()}/intents.json", "w") as f: - json.dump(intents, f, indent=4) - if dialogs: - with open(f"{tx}/{lang.lower()}/dialogs.json", "w") as f: - json.dump(dialogs, f, indent=4) - if vocs: - with open(f"{tx}/{lang.lower()}/vocabs.json", "w") as f: - json.dump(vocs, f, indent=4) - if regexes: - with open(f"{tx}/{lang.lower()}/regexes.json", "w") as f: - json.dump(regexes, f, indent=4) diff --git a/scripts/translate.py b/scripts/translate.py deleted file mode 100644 index cb0dd58..0000000 --- a/scripts/translate.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -from os.path import dirname, join, exists -from ovos_utils.bracket_expansion import expand_options -from libretranslate_neon_plugin import LibreTranslatePlugin - -tx = LibreTranslatePlugin(config={"libretranslate_host": "https://libretranslate.2022.us"}) - -src_lang = "en-us" -target_langs = ["es-es", "de-de", "fr-fr", "it-it", "pt-pt"] - -exts = [".voc", ".dialog", ".intent", ".entity"] -res_folder = join(dirname(dirname(__file__)), "locale") -target_langs = list(set(target_langs + os.listdir(res_folder))) - -src_files = {} -for root, dirs, files in os.walk(res_folder): - if src_lang not in root: - continue - for f in files: - if any(f.endswith(e) for e in exts): - src_files[f] = join(root, f) - -for lang in target_langs: - os.makedirs(join(res_folder, lang), exist_ok=True) - - for name, src in src_files.items(): - dst = join(res_folder, lang, name) - if exists(dst): - continue - - tx_lines = [] - with open(src) as f: - lines = [l for l in f.read().split("\n") if l and not l.startswith("#")] - - for l in lines: - expanded = expand_options(l) - for l2 in expanded: - try: - translated = tx.translate(l2, target=lang, source=src_lang) - tx_lines.append(translated) - except Exception as e: - print(e) - continue - if tx_lines: - with open(dst, "w") as f: - f.write(f"# auto translated from {src_lang} to {lang}\n") - for translated in set(tx_lines): - f.write(translated + "\n") diff --git a/translations/gl-es/dialogs.json b/translations/gl-es/dialogs.json new file mode 100644 index 0000000..a05aa29 --- /dev/null +++ b/translations/gl-es/dialogs.json @@ -0,0 +1,5 @@ +{ + "intro.dialog": [ + "Grazas por instalares News Skill" + ] +} \ No newline at end of file diff --git a/translations/gl-es/vocabs.json b/translations/gl-es/vocabs.json new file mode 100644 index 0000000..8f0918c --- /dev/null +++ b/translations/gl-es/vocabs.json @@ -0,0 +1,84 @@ +{ + "video.voc": [ + "vídeo" + ], + "rt.voc": [ + "Russia Today" + ], + "it.voc": [ + "italiano", + "Italia" + ], + "en-ca.voc": [ + "canadá", + "canadense" + ], + "nl.voc": [ + "Países Baixos", + "Países Baixos", + "neerlandés" + ], + "ca.voc": [ + "catalán", + "Cataluña" + ], + "euronews.voc": [ + "euronews" + ], + "fr.voc": [ + "francés", + "francia" + ], + "es.voc": [ + "español" + ], + "news.voc": [ + "novas" + ], + "en-au.voc": [ + "australia", + "australiano" + ], + "pt-pt.voc": [ + "Portugal", + "portugués" + ], + "euro.voc": [ + "euro", + "europeo" + ], + "en.voc": [ + "inglés" + ], + "de.voc": [ + "alemán" + ], + "fr24.voc": [ + "France 24", + "France vintecatro", + "France vixésimo cuarto", + "France24" + ], + "fi.voc": [ + "finlandia", + "finés" + ], + "sv.voc": [ + "suecia", + "sueco" + ], + "en-gb.voc": [ + "Reino Unido", + "británico", + "reino unido" + ], + "ru.voc": [ + "rusia", + "ruso" + ], + "en-us.voc": [ + "américa", + "estadounidense", + "estados unidos" + ] +} \ No newline at end of file