diff --git a/.github/workflows/auto_translate.yml b/.github/workflows/auto_translate.yml deleted file mode 100644 index 2945f94..0000000 --- a/.github/workflows/auto_translate.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Auto translate -on: - workflow_dispatch: - push: - branches: - - dev - -jobs: - translate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Translate Tools - run: | - pip install git+https://github.com/NeonGeckoCom/neon-lang-plugin-libretranslate - - name: Auto Translate - run: | - python scripts/translate.py - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Auto Translate - branch: dev - prepare_skillstore: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install OSM - run: | - pip install ovos-skills-manager~=0.0.10 - - name: Update Skill Store metadata - run: | - python scripts/prepare_skillstore.py - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Update skill store metadata - branch: dev diff --git a/.github/workflows/publish_alpha.yml b/.github/workflows/publish_alpha.yml index 469617a..8d9e950 100644 --- a/.github/workflows/publish_alpha.yml +++ b/.github/workflows/publish_alpha.yml @@ -16,6 +16,7 @@ on: - 'MANIFEST.in' - 'README.md' - 'scripts/**' + - 'translations/**' workflow_dispatch: jobs: diff --git a/.github/workflows/sync_tx.yml b/.github/workflows/sync_tx.yml new file mode 100644 index 0000000..2fd378e --- /dev/null +++ b/.github/workflows/sync_tx.yml @@ -0,0 +1,32 @@ +name: Run script on merge to dev by gitlocalize-app + +on: + workflow_dispatch: + push: + branches: + - dev + +jobs: + run-script: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + with: + ref: dev + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.9 + + - name: Run script if merged by gitlocalize-app[bot] + if: github.event_name == 'push' && github.event.head_commit.author.username == 'gitlocalize-app[bot]' + run: | + python scripts/sync_translations.py + + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Update translations + branch: dev diff --git a/CHANGELOG.md b/CHANGELOG.md index 8615769..0ad4f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [Unreleased](https://github.com/OpenVoiceOS/skill-ovos-news/tree/HEAD) + +[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-news/compare/V0.0.4a4...HEAD) + +**Closed issues:** + +- No module named 'mycroft\_bus\_client' [\#24](https://github.com/OpenVoiceOS/skill-ovos-news/issues/24) + +## [V0.0.4a4](https://github.com/OpenVoiceOS/skill-ovos-news/tree/V0.0.4a4) (2024-01-13) + +[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-news/compare/V0.0.4a3...V0.0.4a4) + ## [V0.0.4a3](https://github.com/OpenVoiceOS/skill-ovos-news/tree/V0.0.4a3) (2024-01-12) [Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-news/compare/V0.0.4a2...V0.0.4a3) diff --git a/scripts/prepare_skillstore.py b/scripts/prepare_skillstore.py index 5ab3d5b..cfeb125 100644 --- a/scripts/prepare_skillstore.py +++ b/scripts/prepare_skillstore.py @@ -19,7 +19,7 @@ base_dir = dirname(dirname(__file__)) desktop_dir = join(base_dir, "res", "desktop") -android_ui = join(base_dir, "res", "+android") +android_ui = join(base_dir, "qt5", "+android") makedirs(desktop_dir, exist_ok=True) readme = join(base_dir, "README.md") diff --git a/scripts/prepare_translations.py b/scripts/prepare_translations.py new file mode 100644 index 0000000..46dee45 --- /dev/null +++ b/scripts/prepare_translations.py @@ -0,0 +1,53 @@ +"""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}", exist_ok=True) + if intents: + with open(f"{tx}/{lang}/intents.json", "w") as f: + json.dump(intents, f, indent=4) + if dialogs: + with open(f"{tx}/{lang}/dialogs.json", "w") as f: + json.dump(dialogs, f, indent=4) + if vocs: + with open(f"{tx}/{lang}/vocabs.json", "w") as f: + json.dump(vocs, f, indent=4) + if regexes: + with open(f"{tx}/{lang}/regexes.json", "w") as f: + json.dump(regexes, f, indent=4) diff --git a/scripts/sync_translations.py b/scripts/sync_translations.py new file mode 100644 index 0000000..5c69e64 --- /dev/null +++ b/scripts/sync_translations.py @@ -0,0 +1,58 @@ +"""this script should run in every PR originated from @gitlocalize-app +TODO - before PR merge +""" + +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(tx): + intents = f"{tx}/{lang}/intents.json" + dialogs = f"{tx}/{lang}/dialogs.json" + vocs = f"{tx}/{lang}/vocabs.json" + regexes = f"{tx}/{lang}/regexes.json" + + if os.path.isfile(intents): + with open(intents) as f: + data = json.load(f) + for fid, samples in data.items(): + if samples: + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None + with open(f"{locale}/{lang}/{fid}", "w") as f: + f.write("\n".join(sorted(samples))) + + if os.path.isfile(dialogs): + with open(dialogs) as f: + data = json.load(f) + for fid, samples in data.items(): + if samples: + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None + with open(f"{locale}/{lang}/{fid}", "w") as f: + f.write("\n".join(sorted(samples))) + + if os.path.isfile(vocs): + with open(vocs) as f: + data = json.load(f) + for fid, samples in data.items(): + if samples: + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None + with open(f"{locale}/{lang}/{fid}", "w") as f: + f.write("\n".join(sorted(samples))) + + if os.path.isfile(regexes): + with open(regexes) as f: + data = json.load(f) + for fid, samples in data.items(): + if samples: + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None + with open(f"{locale}/{lang}/{fid}", "w") as f: + f.write("\n".join(sorted(samples))) + diff --git a/setup.py b/setup.py index 89ed0aa..65d458c 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def get_requirements(requirements_filename: str): def find_resource_files(): - resource_base_dirs = ("locale", "res", "vocab", "dialog", "regex", "skill") + resource_base_dirs = ("locale", "qt5", "vocab", "dialog", "regex", "skill") base_dir = path.dirname(__file__) package_data = ["*.json"] for res in resource_base_dirs: diff --git a/translations/de-de/dialogs.json b/translations/de-de/dialogs.json new file mode 100644 index 0000000..c19da98 --- /dev/null +++ b/translations/de-de/dialogs.json @@ -0,0 +1,5 @@ +{ + "intro.dialog": [ + "Danke f\u00fcr die Installation News Skill" + ] +} \ No newline at end of file diff --git a/translations/de-de/vocabs.json b/translations/de-de/vocabs.json new file mode 100644 index 0000000..851e52d --- /dev/null +++ b/translations/de-de/vocabs.json @@ -0,0 +1,125 @@ +{ + "video.voc": [ + "Video", + "mit video" + ], + "rt.voc": [ + "Russland heute" + ], + "it.voc": [ + "aus italien", + "italien", + "italienisch", + "italienische" + ], + "en-ca.voc": [ + "aus kanada", + "kanada", + "kanadisch", + "kanadische" + ], + "nl.voc": [ + "aus holland", + "aus niederlande", + "aus den niederlanden", + "holland", + "niederland", + "holl\u00e4ndisch", + "holl\u00e4ndische", + "niederl\u00e4ndisch", + "niederl\u00e4ndische" + ], + "ca.voc": [ + "aus katalonien", + "Katalonien", + "Katalanisch", + "katalonische" + ], + "euronews.voc": [ + "Euronews" + ], + "fr.voc": [ + "aus frankreich", + "frankreich", + "franz\u00f6sisch", + "franz\u00f6sische" + ], + "es.voc": [ + "aus spanien", + "spanien", + "Spanisch", + "spanische" + ], + "news.voc": [ + "die nachrichten", + "nachrichten" + ], + "en-au.voc": [ + "aus Australien", + "Australien", + "australisch", + "australische" + ], + "pt-pt.voc": [ + "aus portugal", + "portugal", + "portugiesisch", + "portugiesische" + ], + "euro.voc": [ + "aus europa", + "europa", + "europ\u00e4isch", + "Europ\u00e4ische", + "Euro" + ], + "en.voc": [ + "aus dem Vereinigten K\u00f6nigreich", + "aus England", + "england", + "englische" + ], + "de.voc": [ + "aus deutschland", + "deutschland", + "deutsch", + "deutsche" + ], + "fr24.voc": [ + "Frankreich 24", + "Frankreich zwanzig vier", + "Frankreich24", + "Frankreich zwanzig vierte" + ], + "fi.voc": [ + "aus finnland", + "finnland", + "finnisch", + "finnische" + ], + "sv.voc": [ + "aus schweden", + "schweden", + "schwedisch", + "schwedische" + ], + "en-gb.voc": [ + "aus dem Vereinigten K\u00f6nigreich", + "aus England", + "england", + "englische" + ], + "ru.voc": [ + "aus russland", + "russland", + "russisch", + "russische" + ], + "en-us.voc": [ + "aus den vereinigten Staaten", + "aus amerika", + "amerika", + "amerikanisch", + "amerikanische" + ] +} \ No newline at end of file diff --git a/translations/en-us/dialogs.json b/translations/en-us/dialogs.json new file mode 100644 index 0000000..2ba396b --- /dev/null +++ b/translations/en-us/dialogs.json @@ -0,0 +1,5 @@ +{ + "intro.dialog": [ + "thank you for installing News Skill" + ] +} \ No newline at end of file diff --git a/translations/en-us/vocabs.json b/translations/en-us/vocabs.json new file mode 100644 index 0000000..5038bc0 --- /dev/null +++ b/translations/en-us/vocabs.json @@ -0,0 +1,84 @@ +{ + "video.voc": [ + "video" + ], + "rt.voc": [ + "Russia Today" + ], + "it.voc": [ + "Italian", + "Italy" + ], + "en-ca.voc": [ + "canada", + "canadian" + ], + "nl.voc": [ + "dutch", + "Nederlands", + "Netherlands" + ], + "ca.voc": [ + "Catalan", + "Catalonia" + ], + "euronews.voc": [ + "euronews" + ], + "fr.voc": [ + "French", + "france" + ], + "es.voc": [ + "Spanish" + ], + "news.voc": [ + "news" + ], + "en-au.voc": [ + "australia", + "australian" + ], + "pt-pt.voc": [ + "Portuguese", + "Portugal" + ], + "euro.voc": [ + "euro", + "european" + ], + "en.voc": [ + "English" + ], + "de.voc": [ + "German" + ], + "fr24.voc": [ + "France24", + "France 24", + "France twenty four", + "France twenty fourth" + ], + "fi.voc": [ + "finland", + "finnish" + ], + "sv.voc": [ + "sweden", + "swedish" + ], + "en-gb.voc": [ + "british", + "united kingdom", + "UK" + ], + "ru.voc": [ + "russian", + "russia" + ], + "en-us.voc": [ + "america", + "american", + "united states" + ] +} \ No newline at end of file diff --git a/translations/es-es/dialogs.json b/translations/es-es/dialogs.json new file mode 100644 index 0000000..ab1124d --- /dev/null +++ b/translations/es-es/dialogs.json @@ -0,0 +1,5 @@ +{ + "intro.dialog": [ + "gracias por instalar Habilidad de noticias" + ] +} \ No newline at end of file diff --git a/translations/es-es/vocabs.json b/translations/es-es/vocabs.json new file mode 100644 index 0000000..ceebf99 --- /dev/null +++ b/translations/es-es/vocabs.json @@ -0,0 +1,82 @@ +{ + "video.voc": [ + "video" + ], + "rt.voc": [ + "Rusia" + ], + "it.voc": [ + "Italia", + "Italiano" + ], + "en-ca.voc": [ + "canadian", + "canada" + ], + "nl.voc": [ + "Pa\u00edses Bajos", + "dutch", + "Nederlands" + ], + "ca.voc": [ + "Catalu\u00f1a", + "Catalan" + ], + "euronews.voc": [ + "euronews" + ], + "fr.voc": [ + "Franco", + "Franc\u00e9s" + ], + "es.voc": [ + "Espa\u00f1ol" + ], + "news.voc": [ + "noticias" + ], + "en-au.voc": [ + "australiana", + "australia" + ], + "pt-pt.voc": [ + "Portugu\u00e9s", + "Portugal" + ], + "euro.voc": [ + "europeas", + "euro" + ], + "en.voc": [ + "Ingl\u00e9s" + ], + "de.voc": [ + "Alem\u00e1n" + ], + "fr24.voc": [ + "Francia 24", + "France24", + "Francia" + ], + "fi.voc": [ + "finland", + "finnish" + ], + "sv.voc": [ + "sweden", + "sueco" + ], + "en-gb.voc": [ + "UK", + "Reino unido", + "Brit\u00e1nico" + ], + "ru.voc": [ + "ruso", + "rusia" + ], + "en-us.voc": [ + "Am\u00e9rica", + "Estados Unidos" + ] +} \ No newline at end of file diff --git a/translations/fr-fr/dialogs.json b/translations/fr-fr/dialogs.json new file mode 100644 index 0000000..b31adb6 --- /dev/null +++ b/translations/fr-fr/dialogs.json @@ -0,0 +1,5 @@ +{ + "intro.dialog": [ + "Merci d'avoir install\u00e9 News Skill" + ] +} \ No newline at end of file diff --git a/translations/fr-fr/vocabs.json b/translations/fr-fr/vocabs.json new file mode 100644 index 0000000..e902566 --- /dev/null +++ b/translations/fr-fr/vocabs.json @@ -0,0 +1,82 @@ +{ + "video.voc": [ + "vid\u00e9o" + ], + "rt.voc": [ + "Russie aujourd'hui" + ], + "it.voc": [ + "Italien", + "Italie" + ], + "en-ca.voc": [ + "canadian", + "canada" + ], + "nl.voc": [ + "Nederlands ?", + "hollandaise", + "Pays-Bas" + ], + "ca.voc": [ + "Catalogne", + "Catalan" + ], + "euronews.voc": [ + "euronews" + ], + "fr.voc": [ + "france", + "Fran\u00e7ais" + ], + "es.voc": [ + "Espagnol" + ], + "news.voc": [ + "nouvelles" + ], + "en-au.voc": [ + "australian", + "australia" + ], + "pt-pt.voc": [ + "Portugais", + "Portugal" + ], + "euro.voc": [ + "european", + "euro" + ], + "en.voc": [ + "Anglais" + ], + "de.voc": [ + "Allemand" + ], + "fr24.voc": [ + "France 24", + "France24", + "France" + ], + "fi.voc": [ + "finland", + "finnish" + ], + "sv.voc": [ + "su\u00e9dois" + ], + "en-gb.voc": [ + "royaume uni", + "british", + "UK" + ], + "ru.voc": [ + "russe", + "russie" + ], + "en-us.voc": [ + "america", + "am\u00e9ricains", + "Etats unis" + ] +} \ No newline at end of file diff --git a/translations/it-it/dialogs.json b/translations/it-it/dialogs.json new file mode 100644 index 0000000..e1e24fd --- /dev/null +++ b/translations/it-it/dialogs.json @@ -0,0 +1,5 @@ +{ + "intro.dialog": [ + "Grazie per aver installato il modulo Notizie di Ovos" + ] +} \ No newline at end of file diff --git a/translations/it-it/vocabs.json b/translations/it-it/vocabs.json new file mode 100644 index 0000000..410b662 --- /dev/null +++ b/translations/it-it/vocabs.json @@ -0,0 +1,82 @@ +{ + "video.voc": [ + "video" + ], + "rt.voc": [ + "Russia Oggi" + ], + "it.voc": [ + "Italia", + "Italian(o|a)" + ], + "en-ca.voc": [ + "Canada", + "Canadese" + ], + "nl.voc": [ + "Paesi Bassi", + "Olanda", + "Olandese" + ], + "ca.voc": [ + "Catalano", + "Catalogna" + ], + "euronews.voc": [ + "euronews" + ], + "fr.voc": [ + "Francia", + "Francese" + ], + "es.voc": [ + "Spagnolo" + ], + "news.voc": [ + "Notizie", + "Notiziario" + ], + "en-au.voc": [ + "Australiano", + "Australia" + ], + "pt-pt.voc": [ + "Portogallo", + "Portoghese" + ], + "euro.voc": [ + "Europeo", + "Europa" + ], + "en.voc": [ + "Inglese" + ], + "de.voc": [ + "Germania" + ], + "fr24.voc": [ + "Francia 24", + "Francia" + ], + "fi.voc": [ + "Finlandese", + "Finlandia" + ], + "sv.voc": [ + "Svezia", + "Svedese" + ], + "en-gb.voc": [ + "Inglese", + "Regno Unito", + "Gran Bretagna" + ], + "ru.voc": [ + "Russia" + ], + "en-us.voc": [ + "America", + "American(o|a)", + "Stati Uniti" + ] +} \ No newline at end of file diff --git a/translations/pt-pt/dialogs.json b/translations/pt-pt/dialogs.json new file mode 100644 index 0000000..657a907 --- /dev/null +++ b/translations/pt-pt/dialogs.json @@ -0,0 +1,5 @@ +{ + "intro.dialog": [ + "Obrigado por instalar Habilidade de not\u00edcias" + ] +} \ No newline at end of file diff --git a/translations/pt-pt/vocabs.json b/translations/pt-pt/vocabs.json new file mode 100644 index 0000000..f61a297 --- /dev/null +++ b/translations/pt-pt/vocabs.json @@ -0,0 +1,82 @@ +{ + "video.voc": [ + "v\u00eddeo" + ], + "rt.voc": [ + "R\u00fassia Hoje" + ], + "it.voc": [ + "Italiano", + "It\u00e1lia" + ], + "en-ca.voc": [ + "canadiano", + "canada" + ], + "nl.voc": [ + "Pa\u00edses Baixos", + "Dutch", + "Nederlands" + ], + "ca.voc": [ + "Catalunha", + "Catal\u00e3o" + ], + "euronews.voc": [ + "euronews" + ], + "fr.voc": [ + "Franc\u00eas", + "Fran\u00e7a" + ], + "es.voc": [ + "Espanhol" + ], + "news.voc": [ + "not\u00edcias" + ], + "en-au.voc": [ + "australian", + "australiana" + ], + "pt-pt.voc": [ + "Portugal", + "Portugu\u00eas" + ], + "euro.voc": [ + "Europeia", + "euro" + ], + "en.voc": [ + "Ingl\u00eas" + ], + "de.voc": [ + "Alemanha" + ], + "fr24.voc": [ + "Fran\u00e7a24", + "Fran\u00e7a vinte e quatro", + "Fran\u00e7a 24" + ], + "fi.voc": [ + "finland\u00eas", + "Finl\u00e2ndia" + ], + "sv.voc": [ + "- N\u00e3o", + "sueco" + ], + "en-gb.voc": [ + "reino unido", + "Reino Unido", + "Brit\u00e2nico" + ], + "ru.voc": [ + "R\u00fassia", + "Russian" + ], + "en-us.voc": [ + "Estados Unidos", + "Am\u00e9rica do Sul" + ] +} \ No newline at end of file diff --git a/version.py b/version.py index a7d90f3..4883eff 100644 --- a/version.py +++ b/version.py @@ -2,5 +2,5 @@ VERSION_MAJOR = 0 VERSION_MINOR = 0 VERSION_BUILD = 4 -VERSION_ALPHA = 4 +VERSION_ALPHA = 5 # END_VERSION_BLOCK