Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add transifex automatic translations #238

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .ci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,94 @@
ASPECTS_CLICKHOUSE_CMS_PASSWORD: CTr93c8cLJGg6ZT6gAl1dhTy
ASPECTS_CLICKHOUSE_CMS_USER: ch_cms
ASPECTS_CLICKHOUSE_LRS_PASSWORD: H4PhxiANv23tmOcL3nAeQQTX
ASPECTS_CLICKHOUSE_LRS_USER: ch_lrs
ASPECTS_CLICKHOUSE_REPORT_PASSWORD: 6lVwUJ4p6SLosW86u0tRKWn8
ASPECTS_CLICKHOUSE_REPORT_USER: ch_report
ASPECTS_CLICKHOUSE_VECTOR_PASSWORD: 1lReLfYAbyrsdwp7AcQF3paw
ASPECTS_CLICKHOUSE_VECTOR_USER: ch_vector
CLICKHOUSE_ADMIN_PASSWORD: DHkFoZQ2lTH7fF3N1hUOQplI
CLICKHOUSE_ADMIN_USER: ch_admin
CLICKHOUSE_SECURE_CONNECTION: false
CMS_HOST: studio.local.overhang.io
CMS_OAUTH2_SECRET: V8553RMCO27CBJEx3X4xTh9a
CONTACT_EMAIL: [email protected]
ENABLE_HTTPS: false
ID: QHbF6pRUqoRIPS6HAULDtfiJ
JWT_RSA_PRIVATE_KEY: '-----BEGIN RSA PRIVATE KEY-----

MIIEpQIBAAKCAQEAzikDcXeaAH4ovS/bpIOL0GobhcNoBfKsRok1dafTHP0m0CNR

DzJFiZIbYSp2N//de2/pIcjuD9dWHZhsytc+WIZq9jt24VchjI5UAzLcAURKh64U

qHUfaMs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eS9aV0w3

+ViJjEsZ3O3kv3KbBKQPyw0CgYEA8+wLrmySGlU1gGqBMXv9MZ75OQ3cuZMuJzJ0

0T7PnIsmIX+o5k7U13ULvgkv58ar2jeY+DSYpz+hKt5Izxs+w4h2UQBIrWozYZX7

53+ng2ngj0fqN77So2L2DAoaJGYSeONg72PnQrnp6HD2gBW5AqeZ5QjdyCfu9N87

SFUzz4kCgYEAuR0jhcMdh9KA2VrYaqMa8c4HBTjBkb9trgNMb55vfKB/O0q6NfBg

KcT1MM56FmhPLj3P1aDKPliczaOxsbRh4oRQYTSUSOCdvhXe9ZilrnFHelVmIw07

i8A6TC850sHwR1j3p1wfyAaHX7eCPMP4EglRzHEjSRfFw1x5CwnejPk=

-----END RSA PRIVATE KEY-----'
LANGUAGE_CODE: en
LMS_HOST: local.overhang.io
MYSQL_ROOT_PASSWORD: 6KFFc2L9
OPENEDX_MYSQL_PASSWORD: 93pugaBr
OPENEDX_SECRET_KEY: 6BxYaHmIkV8R3tFm96UcLBMG
PLATFORM_NAME: Aspects Local CI Test
PLUGINS:
- aspects
PLUGIN_INDEXES:
- https://overhang.io/tutor/main
RALPH_ADMIN_HASHED_PASSWORD: $2b$12$tUVfJTDDwFSe4wOh5ysJd.LGa6SNyaFvzj7FnC6Oc9REVoeCWHMfu
RALPH_ADMIN_PASSWORD: wlnktlsthqiprtsvanzrcynhnbvoxirmvzwv
RALPH_ADMIN_USERNAME: ralph
RALPH_LMS_HASHED_PASSWORD: $2b$12$tIHqFKghkExV/pqzN.pDmesz60PEWB4Cy1Q.Jg.lwOVvoYMHCDVu.
RALPH_LMS_PASSWORD: jpjgcgrlnnarlsgjhnkmguhdogqhslwwedmg
RALPH_LMS_USERNAME: lms
SUPERSET_ADMIN_PASSWORD: rGYfsLzCPcFBRL5grttE5JxR
SUPERSET_ADMIN_USERNAME: frzy1EHeGXlY
SUPERSET_DB_PASSWORD: A7CG3FSpABCgWPWtnHiJFe7Y
SUPERSET_OAUTH2_CLIENT_ID: vZHFGoAE9VPjMOVn
SUPERSET_OAUTH2_CLIENT_ID_DEV: OlR3BXJBNx9C21N7
SUPERSET_OAUTH2_CLIENT_SECRET: StkPwE5GzPuyH4Rp
SUPERSET_ROW_LEVEL_SECURITY_XAPI_GROUP_KEY: xapi_course_id
SUPERSET_SECRET_KEY: WlgA6QSQKCUNGD9PAaji0JHY
SUPERSET_XAPI_DASHBOARD_SLUG: openedx-xapi
49 changes: 49 additions & 0 deletions .github/workflows/compile-translations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Pull Translations
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1' # On Mondays

env:
TUTOR_ROOT: ./.ci/
TRANSIFEX_TOKEN: ${{ secrets.EDUNEXT_ASPECTS_ASSET_TRANSIFEX_TOKEN }}
TRANSIFEX_SECRET: ${{ secrets.EDUNEXT_ASPECTS_ASSET_TRANSIFEX_SECRET }}

jobs:
push_translations:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install aspects
run: pip install .
- name: Install requirements
run: make requirements
- name: Mark for translation
run: make compile_translations
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Push branch
run: |
git status
git log -l 3
git checkout -b bot/translations/${{ steps.date.outputs.date }}
git push -d origin bot/translations/${{ steps.date.outputs.date }}
git push origin bot/translations/${{ steps.date.outputs.date }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.EDX_TRANSIFEX_BOT_GITHUB_TOKEN }}
title: "chore(i18n): updating translations"
Ian2012 marked this conversation as resolved.
Show resolved Hide resolved
commit-message: "chore(i18n): updating translations on ${{ steps.date.outputs.date }}"
branch: "bot/translations/${{ steps.date.outputs.date }}"
base: main
body: |
Automated update of translations for assets on ${{ steps.date.outputs.date }}.

This pull request was automatically generated.
27 changes: 27 additions & 0 deletions .github/workflows/push-translations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Push Translations
on:
push:
branches:
- main

env:
TUTOR_ROOT: ./.ci/
TRANSIFEX_TOKEN: ${{ secrets.EDUNEXT_ASPECTS_ASSET_TRANSIFEX_TOKEN }}
TRANSIFEX_SECRET: ${{ secrets.EDUNEXT_ASPECTS_ASSET_TRANSIFEX_SECRET }}

jobs:
push_translations:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install aspects
run: pip install .
- name: Install requirements
run: make requirements
- name: Mark for translation
run: make push_translations
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ __pycache__
/dist/
/.idea/
venv/
env/
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SOURCES=./setup.py ./$(PACKAGE)
BLACK_OPTS = --exclude templates ${SOURCES}

UPGRADE=CUSTOM_COMPILE_COMMAND='make upgrade' pip-compile --upgrade

TUTOR_ROOT=$(PWD)/.ci
###### Development

COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt
Expand Down Expand Up @@ -78,6 +78,13 @@ release-push:
git push origin $(TAG)

###### Additional commands
push_translations:
TUTOR_ROOT=$(TUTOR_ROOT) tutor config save
python scripts/translate.py $(TUTOR_ROOT) push

compile_translations:
TUTOR_ROOT=$(TUTOR_ROOT) tutor config save
python scripts/translate.py $(TUTOR_ROOT) compile

version: ## Print the current tutor version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("$(PACKAGE)", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
Expand Down
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
click
tutor>=15
bcrypt
transifex-python
19 changes: 19 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
appdirs==1.4.4
# via tutor
asttokens==2.2.1
# via transifex-python
bcrypt==4.0.1
# via -r requirements/base.in
cachetools==5.3.1
Expand All @@ -19,7 +21,10 @@ charset-normalizer==3.2.0
click==8.1.6
# via
# -r requirements/base.in
# transifex-python
# tutor
future==0.18.3
# via pyseeyou
google-auth==2.22.0
# via kubernetes
idna==3.4
Expand All @@ -38,6 +43,8 @@ oauthlib==3.2.2
# via
# kubernetes
# requests-oauthlib
parsimonious==0.10.0
# via pyseeyou
pyasn1==0.5.0
# via
# pyasn1-modules
Expand All @@ -46,27 +53,39 @@ pyasn1-modules==0.3.0
# via google-auth
pycryptodome==3.18.0
# via tutor
pyseeyou==1.0.2
# via transifex-python
python-dateutil==2.8.2
# via kubernetes
pytz==2023.3
# via transifex-python
pyyaml==6.0.1
# via
# kubernetes
# tutor
regex==2023.6.3
# via parsimonious
requests==2.31.0
# via
# kubernetes
# requests-oauthlib
# transifex-python
requests-oauthlib==1.3.1
# via kubernetes
rsa==4.9
# via google-auth
six==1.16.0
# via
# asttokens
# google-auth
# kubernetes
# python-dateutil
tomli==2.0.1
# via mypy
toolz==0.12.0
# via pyseeyou
transifex-python==3.4.0
# via -r requirements/base.in
tutor==16.0.3
# via -r requirements/base.in
typing-extensions==4.7.1
Expand Down
35 changes: 34 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ appdirs==1.4.4
# tutor
astroid==2.15.6
# via pylint
asttokens==2.2.1
# via
# -r requirements/base.txt
# transifex-python
bcrypt==4.0.1
# via -r requirements/base.txt
black==23.7.0
Expand All @@ -37,13 +41,18 @@ click==8.1.6
# via
# -r requirements/base.txt
# black
# transifex-python
# tutor
cryptography==41.0.2
# via secretstorage
dill==0.3.7
# via pylint
docutils==0.20.1
# via readme-renderer
future==0.18.3
# via
# -r requirements/base.txt
# pyseeyou
google-auth==2.22.0
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -106,6 +115,10 @@ oauthlib==3.2.2
# requests-oauthlib
packaging==23.1
# via black
parsimonious==0.10.0
# via
# -r requirements/base.txt
# pyseeyou
pathspec==0.11.2
# via black
pkginfo==1.9.6
Expand Down Expand Up @@ -139,23 +152,36 @@ pyinstaller-hooks-contrib==2023.6
# via pyinstaller
pylint==2.17.5
# via -r requirements/dev.in
pyseeyou==1.0.2
# via
# -r requirements/base.txt
# transifex-python
python-dateutil==2.8.2
# via
# -r requirements/base.txt
# kubernetes
pytz==2023.3
# via
# -r requirements/base.txt
# transifex-python
pyyaml==6.0.1
# via
# -r requirements/base.txt
# kubernetes
# tutor
readme-renderer==40.0
# via twine
regex==2023.6.3
# via
# -r requirements/base.txt
# parsimonious
requests==2.31.0
# via
# -r requirements/base.txt
# kubernetes
# requests-oauthlib
# requests-toolbelt
# transifex-python
# twine
requests-oauthlib==1.3.1
# via
Expand All @@ -165,7 +191,7 @@ requests-toolbelt==1.0.0
# via twine
rfc3986==2.0.0
# via twine
rich==13.5.0
rich==13.5.2
# via twine
rsa==4.9
# via
Expand All @@ -176,6 +202,7 @@ secretstorage==3.3.3
six==1.16.0
# via
# -r requirements/base.txt
# asttokens
# bleach
# google-auth
# kubernetes
Expand All @@ -188,6 +215,12 @@ tomli==2.0.1
# pylint
tomlkit==0.12.1
# via pylint
toolz==0.12.0
# via
# -r requirements/base.txt
# pyseeyou
transifex-python==3.4.0
# via -r requirements/base.txt
tutor==16.0.3
# via -r requirements/base.txt
twine==4.0.2
Expand Down
5 changes: 3 additions & 2 deletions scripts/serialize-assets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from zipfile import ZipFile
import os
import sys
from zipfile import ZipFile

import yaml
import os


def serialize_assets(path):
Expand Down
Loading