-
Notifications
You must be signed in to change notification settings - Fork 3
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
23 changed files
with
271 additions
and
28 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This workflow will generate a distribution and upload it to PyPI | ||
|
||
name: Publish to pypi | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_and_publish: | ||
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 Build Tools | ||
run: | | ||
python -m pip install build wheel | ||
- name: Build Distribution Packages | ||
run: | | ||
python setup.py bdist_wheel | ||
- name: Publish to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{secrets.PYPI_TOKEN}} |
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,37 @@ | ||
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 manual dispatch | ||
if: github.event_name == 'workflow_dispatch' | ||
run: | | ||
python scripts/sync_translations.py | ||
- 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
matplotlib | ||
https://github.com/matplotlib/basemap/archive/master.zip | ||
basemap | ||
pillow | ||
requests | ||
requests-cache | ||
mtranslate | ||
requests-cache |
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(".locale"): | ||
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) |
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,78 @@ | ||
"""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 = list(set([s.strip() for s in samples | ||
if s and s.strip() != "[UNUSED]"])) # s may be None | ||
if fid.startswith("/"): | ||
p = f"{locale}/{lang.lower()}{fid}" | ||
else: | ||
p = f"{locale}/{lang.lower()}/{fid}" | ||
os.makedirs(os.path.dirname(p), exist_ok=True) | ||
with open(f"{locale}/{lang.lower()}/{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 = list(set([s.strip() for s in samples | ||
if s and s.strip() != "[UNUSED]"])) # s may be None | ||
if fid.startswith("/"): | ||
p = f"{locale}/{lang.lower()}{fid}" | ||
else: | ||
p = f"{locale}/{lang.lower()}/{fid}" | ||
os.makedirs(os.path.dirname(p), exist_ok=True) | ||
with open(f"{locale}/{lang.lower()}/{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 = list(set([s.strip() for s in samples | ||
if s and s.strip() != "[UNUSED]"])) # s may be None | ||
if fid.startswith("/"): | ||
p = f"{locale}/{lang.lower()}{fid}" | ||
else: | ||
p = f"{locale}/{lang.lower()}/{fid}" | ||
os.makedirs(os.path.dirname(p), exist_ok=True) | ||
with open(f"{locale}/{lang.lower()}/{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 = list(set([s.strip() for s in samples | ||
if s and s.strip() != "[UNUSED]"])) # s may be None | ||
if fid.startswith("/"): | ||
p = f"{locale}/{lang.lower()}{fid}" | ||
else: | ||
p = f"{locale}/{lang.lower()}/{fid}" | ||
os.makedirs(os.path.dirname(p), exist_ok=True) | ||
with open(f"{locale}/{lang.lower()}/{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 |
---|---|---|
|
@@ -2,11 +2,12 @@ | |
from setuptools import setup | ||
from os.path import abspath, dirname, join, isfile, isdir | ||
from os import walk | ||
import os | ||
|
||
# Define package information | ||
SKILL_CLAZZ = "ISSLocationSkill" # Make sure it matches __init__.py class name | ||
VERSION = "0.0.1" | ||
URL = "https://github.com/OVOSHatchery/ovos-skill-iss-location" | ||
VERSION = "0.1.0a1" | ||
URL = "https://github.com/OpenVoiceOS/ovos-skill-iss-location" | ||
AUTHOR = "OpenVoiceOS" | ||
EMAIL = "[email protected]" | ||
LICENSE = "Apache2.0" | ||
|
@@ -36,7 +37,7 @@ def get_requirements(requirements_filename: str = "requirements.txt"): | |
|
||
# Function to find resource files | ||
def find_resource_files(): | ||
resource_base_dirs = ("locale", "ui", "vocab", "dialog", "regex", "res") | ||
resource_base_dirs = ("locale", "ui", "res") | ||
base_dir = abspath(dirname(__file__)) | ||
package_data = ["*.json"] | ||
for res in resource_base_dirs: | ||
|
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,27 @@ | ||
{ | ||
"when_iss.intent": [ | ||
"when is the I S S passing by", | ||
"when is the space station passing by", | ||
"when is the international space station passing by", | ||
"international space station passing over" | ||
], | ||
"where_iss.intent": [ | ||
"where is the I S S", | ||
"where is the space station", | ||
"where is the international space station", | ||
"international space station location", | ||
"location of the space station", | ||
"location of I S S", | ||
"I S S location" | ||
], | ||
"about.intent": [ | ||
"about the ISS", | ||
"about the space station", | ||
"talk about the international space station", | ||
"what is ISS", | ||
"tell me about international space station", | ||
"talk about international space station", | ||
"tell me about international space station", | ||
"what is the international space station" | ||
] | ||
} |
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,25 @@ | ||
{ | ||
"how_many.voc": [ | ||
"how many", | ||
"number", | ||
"total" | ||
], | ||
"onboard.voc": [ | ||
"on board", | ||
"on the", | ||
"aboard", | ||
"staying" | ||
], | ||
"who.voc": [ | ||
"who", | ||
"person", | ||
"persons", | ||
"people" | ||
], | ||
"iss.voc": [ | ||
"ISS", | ||
"I S S", | ||
"space station", | ||
"international space station" | ||
] | ||
} |