forked from MycroftAI/skill-spelling
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
386 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ on: | |
- 'MANIFEST.in' | ||
- 'README.md' | ||
- 'scripts/**' | ||
- 'translations/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"""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 for s in samples if s] # 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 for s in samples if s] # 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 for s in samples if s] # 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 for s in samples if s] # s may be None | ||
with open(f"{locale}/{lang}/{fid}", "w") as f: | ||
f.write("\n".join(sorted(samples))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(lletreja|com s'escriu|ortografia) (de la paraula|del mot|de les paraules|dels mots) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"(lletreja|com s'escriu)", | ||
"(com s'escriu|lletreja) (el mot|la paraula)", | ||
"(com s'escriu|lletrejament de|lletreig de)", | ||
"(lletrejament|lletreig) (del mot|de la paraula)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(stav ordet|stav ord|stavningen af ordet|stavningen(?! the)|stav(?! the)) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"stav", | ||
"stav ord", | ||
"stavning af", | ||
"stavning af ord" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(Buchstabiere mir|wie schreibt man|wie buchstabiert man|wie schreibt man(?! the)|spell(?! the)) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"buchstabiere", | ||
"buchstabiere das Wort", | ||
"Aussprache von", | ||
"Aussprache von dem wort" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(\u03c3\u03c5\u03bb\u03bb\u03ac\u03b2\u03b9\u03c3\u03b5 \u03c4\u03b7 \u03bb\u03ad\u03be\u03b7|\u03c3\u03c5\u03bb\u03bb\u03ac\u03b2\u03b9\u03c3\u03b5 \u03bb\u03ad\u03be\u03b7|\u03c3\u03c5\u03bb\u03bb\u03ac\u03b2\u03b9\u03c3\u03bc\u03b1 \u03c4\u03b7\u03c2 \u03bb\u03ad\u03be\u03b7\u03c2|) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"\u03c3\u03c5\u03bb\u03bb\u03b1\u03b2\u03af\u03b6\u03c9", | ||
"\u03c3\u03c5\u03bb\u03bb\u03b1\u03b2\u03af\u03b6\u03c9 \u03bb\u03ad\u03be\u03b7", | ||
"\u03c3\u03c5\u03bb\u03bb\u03b1\u03b2\u03b9\u03c3\u03bc\u03cc\u03c2 \u03c4\u03b7\u03c2", | ||
"\u03c3\u03c5\u03bb\u03bb\u03b1\u03b2\u03b9\u03c3\u03bc\u03cc\u03c2 \u03c4\u03b7\u03c2 \u03bb\u03ad\u03be\u03b7\u03c2" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(spell the word|spell word|spelling of the word|spelling of(?! the)|spell(?! the)) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"spell", | ||
"spell word", | ||
"spelling of", | ||
"spelling of word" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(deletrea la palabra|deletrea|deletreo de la palabra|deletrear(?! la)|deletrea(?! la)) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"deletrear", | ||
"deletrear la palabra ", | ||
"deletrear de ", | ||
"deletrea la palabra" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(letreiatu|letraka esan|esan letraka) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"Spell.voc": [ | ||
"letreiatu", | ||
"letraka esan", | ||
"esan letraka" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(\u0627\u0633\u067e\u0644 \u06a9\u0646|\u0627\u0633\u067e\u0644 \u06a9\u0644\u0645\u0647|\u0647\u062c\u06cc \u06a9\u0646|\u0647\u062c\u06cc \u06a9\u0644\u0645\u0647) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"\u0647\u062c\u06cc \u06a9\u0646", | ||
"\u06a9\u0644\u0645\u0647 \u0647\u062c\u06cc \u06a9\u0646", | ||
"\u0647\u062c\u06cc", | ||
"\u0647\u062c\u06cc \u06a9\u0644\u0645\u0647" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(\u00e9pelle le mot|\u00e9pelle|orthographe du mot|orthographe de|\u00e9criture de) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"\u00e9pelle", | ||
"\u00e9pelle le mot", | ||
"\u00e9pellation de", | ||
"\u00e9pellation du mot" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(deletrea a palabra|deletreo da palabra|ortograf\u00eda de(?! the)|deletrea(?! the)) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"deletrear", | ||
"deletrear palabra", | ||
"ortograf\u00eda de", | ||
"deletreo da palabra" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(?P<Word>\\w+) (kiejt\u00e9se|helyes\u00edr\u00e1sa|bet\u0171z\u00e9se)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"bet\u0171zd", | ||
"bet\u0171zd azt, hogy", | ||
"hogy \u00edrjuk azt hogy", | ||
"hogy \u00edrjuk azt a sz\u00f3t hogy" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(fai lo spelling|spelling della parola) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"ortografia", | ||
"ortografia parola", | ||
"ortografia di", | ||
"ortografia della parola" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(spel het woord|spel woord|spelling of het woord|spelling of(?! the)|spel(?! het)) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"spellen", | ||
"woord spellen", | ||
"spelling van", | ||
"spelling van woord" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(przeliteruj s\u0142owo|literuj s\u0142owo|litery w s\u0142owie) (?P<Word>\\w+)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Spell.voc": [ | ||
"literuj", | ||
"literowanie", | ||
"pisownia", | ||
"pisownia s\u0142owa" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"word.rx": [ | ||
"(soletre a palavra| soletra\u00e7\u00e3o da palavra | ortografia de |soletre) (?P<Word>\\w+)" | ||
] | ||
} |
Oops, something went wrong.