-
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
20 changed files
with
1,219 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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# This workflow will generate a distribution and upload it to PyPI | ||
|
||
name: Publish Alpha Build ...aX | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
paths-ignore: | ||
- 'test/**' | ||
- 'examples/**' | ||
- '.github/**' | ||
- '.gitignore' | ||
- 'LICENSE' | ||
- 'CHANGELOG.md' | ||
- 'MANIFEST.in' | ||
- 'readme.md' | ||
- 'scripts/**' | ||
- 'translations/**' | ||
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: Increment Version | ||
run: | | ||
VER=$(python setup.py --version) | ||
python scripts/bump_alpha.py | ||
- name: "Generate release changelog" | ||
uses: heinrichreimer/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
id: changelog | ||
- name: Commit to dev | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Prepare alpha version package | ||
branch: dev | ||
- name: version | ||
run: echo "::set-output name=version::$(python setup.py --version)" | ||
id: version | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: V${{ steps.version.outputs.version }} | ||
release_name: Release ${{ steps.version.outputs.version }} | ||
body: | | ||
Changes in this Release | ||
${{ steps.changelog.outputs.changelog }} | ||
draft: false | ||
prerelease: true | ||
- 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,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,63 @@ | ||
{ | ||
"/dialog/movie.popular.dialog": [ | ||
"De nyeste popul\u00e6re film der er ude nu er {popul\u00e6rliste}.", | ||
"{popularlist} top filmen charts lige nu." | ||
], | ||
"/dialog/movie.production.single.dialog": [ | ||
"Produktionsselskabet {company} producerede filmen {movie}" | ||
], | ||
"/dialog/movie.genre.multiple.dialog": [ | ||
"Filmen (filmen | filmen | flicken) findes i en af \u200b\u200bgenrene; {genrelist} og {genrelistlast}", | ||
"Folk mener (filmen | filmen) er en {genrelist} eller en {genrelistlastlast}" | ||
], | ||
"/dialog/genre.movie.search.dialog": [ | ||
"filmene med genren {genre} er;" | ||
], | ||
"/dialog/genre.tv.search.dialog": [ | ||
"(fjernsyn | tv) (shows | serier) med genren {genre} er;" | ||
], | ||
"/dialog/no.info.dialog": [ | ||
"Undskyld. Jeg kan ikke finde nogen oplysninger om filmen {movie}" | ||
], | ||
"/dialog/movie.description.dialog": [ | ||
"(filmen | filmen) {movie} handler om dette.", | ||
"her er en oversigt over (filmen | filmen) {film}." | ||
], | ||
"/dialog/movie.recommendations.dialog": [ | ||
"Jeg anbefaler filmmene {movielist}, hvis du kan lide filmen (filnen | flicken) {movie}", | ||
"Filmerne {movielist} er et godt valg, hvis du kan lide filmen {movie}" | ||
], | ||
"/dialog/movie.info.response.dialog": [ | ||
"{movie} blev udgivet den {\u00e5r} med et budget p\u00e5 {budget} dollars." | ||
], | ||
"/dialog/movie.top.dialog": [ | ||
"Dette er (top | den mest popul\u00e6re) film (ude | der spiller) nu; {Topliste}", | ||
"{toplist} er (top | den mest popul\u00e6re) film (ude | der spiller) nu." | ||
], | ||
"/dialog/movie.year.dialog": [ | ||
"(filmen | flicken) {movie} blev (udgivet) i {\u00e5r}" | ||
], | ||
"/dialog/movie.genre.single.dialog": [ | ||
"(filmen | filmen) {movie} kunne v\u00e6re en {genre}", | ||
"Du kan finde (filmen | flicken) {movie} under sektionen {genre}" | ||
], | ||
"/dialog/movie.production.multiple.dialog": [ | ||
"Virksomhederne {companies} og {lastcompany} producerede filmen {movie}", | ||
"{companies} og {lastcompany} producerede filmen {movie}" | ||
], | ||
"/dialog/movie.cast.dialog": [ | ||
"Her er casten af \u200b\u200b{movie}; {actorlist} og {lastactor}", | ||
"F\u00f8lgende personer (star | play | act) i filmen {movie}; {actorlist} og {lastactor}" | ||
], | ||
"/dialog/bad.genre.catagory.dialog": [ | ||
"Jeg kan ikke finde nogen (film | film) med genren {genre}" | ||
], | ||
"/dialog/no.info.general.dialog": [ | ||
"Jeg er ked af det, jeg kan ikke finde den liste, du leder efter lige nu; sp\u00f8rg igen senere." | ||
], | ||
"/dialog/movie.runtime.dialog": [ | ||
"Filmen {movie}, varer i {runtime} minutter.", | ||
"Filmen {movie} er {runtime} minutter lang.", | ||
"Hvis du ser {movie}; Du kan forvente omkring {runtime} minutter, f\u00f8r du kan f\u00e5 en tissepause." | ||
] | ||
} |
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,51 @@ | ||
{ | ||
"/vocab/genre.movie.search.intent": [ | ||
"(list | find) film der er (i genren | en) {genre}", | ||
"(list | find) {genre} film" | ||
], | ||
"/vocab/movie.popular.intent": [ | ||
"(liste | s\u00f8gning | s\u00f8g efter) popul\u00e6re film", | ||
"hvad er (| de) popul\u00e6re film (der spiller | er ude) nu" | ||
], | ||
"/vocab/movie.information.intent": [ | ||
"(find | led efter | er der) (information | info) (p\u00e5 | om) (filmen |) {movie}", | ||
"(giv | fort\u00e6l | hent) (| mig | os) (information | info) (p\u00e5 | om) (filmen | ) {movie}", | ||
"(har du | kan du f\u00e5) (info | information) (p\u00e5| om) (filmen | ) {movie}" | ||
], | ||
"/vocab/movie.production.intent": [ | ||
"(hvem | hvilket firma) ahr (produceret | lavet) filmen {movie}" | ||
], | ||
"/vocab/movie.top.intent": [ | ||
"(list | hvad er | s\u00f8g efter) de (top | mest popul\u00e6re | h\u00f8jst vurderede) film (der spiller | er ude) (| nu)" | ||
], | ||
"/vocab/movie.genres.intent": [ | ||
"hvad (genrer | genre) tilh\u00f8rer (filmen|) {movie}", | ||
"hvad er (genrer | genre) af (filmen|) {movie}", | ||
"hvad (genrer | genre) er (filmem | ) {film}" | ||
], | ||
"/vocab/movie.recommendations.intent": [ | ||
"anbefal en film der (ligner | lignende) {movie}", | ||
"hvilke film (ville | kan) du anbefale (der ligner | der lignende) {movie}", | ||
"(list | f\u00e5) (gode|) film (der ligner | der lignende) {movie}" | ||
], | ||
"/vocab/movie.year.intent": [ | ||
"(hvilket \u00e5r | hvorn\u00e5r | hvilken dato) var filmen {movie} (lavet | frigivet)" | ||
], | ||
"/vocab/movie.runtime.intent": [ | ||
"Hvor lang tid (er|varer) (filmen|) {movie}", | ||
"Hvad er spiletiden (for|p\u00e5) (filmen|) (film)", | ||
"F\u00e5 (runtime | l\u00e6ngden) af (film | film | flick) {movie}" | ||
], | ||
"/vocab/movie.description.intent": [ | ||
"Hvad handler filmen {movie} om", | ||
"fort\u00e6l (mig | os) om (filmen|) {movie}", | ||
"giv (mig | os) en (beskrivelse | synopsis) af (filmen|) {movie}" | ||
], | ||
"/vocab/genre.tv.search.intent": [ | ||
"(list | find) (tv-shows | fjernsynsprogrammer | programmer) der er (en |) {genre}", | ||
"(list | find) {genre} (tv-shows | fjernsnsprogrammer | programmer)" | ||
], | ||
"/vocab/movie.cast.intent": [ | ||
"hvem (spiller | er) i filmen {film}" | ||
] | ||
} |
Oops, something went wrong.