Skip to content

Commit

Permalink
chore: recursively sort translation files (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristhian Garcia authored May 6, 2024
1 parent 2256b13 commit 225b57f
Show file tree
Hide file tree
Showing 14 changed files with 5,927 additions and 4,760 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ pull_translations: translation-requirements
atlas pull -g $(OPENEDX_ATLAS_ARGS) translations/tutor-contrib-aspects/tutoraspects/*:tutoraspects/templates/

@echo "Translations have been pulled via Atlas."
python scripts/translate.py . compile
python tutoraspects/translations/translate.py . compile

extract_translations: translation-requirements
python scripts/translate.py . extract
python tutoraspects/translations/translate.py . extract

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
Expand Up @@ -4,3 +4,4 @@ importlib-resources
openedx-atlas
transifex-python
tutor>=15
ruamel.yaml
4 changes: 4 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ requests-oauthlib==2.0.0
# via kubernetes
rsa==4.9
# via google-auth
ruamel-yaml==0.18.6
# via -r requirements/base.in
ruamel-yaml-clib==0.2.8
# via ruamel-yaml
six==1.16.0
# via
# asttokens
Expand Down
6 changes: 6 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ rsa==4.9
# via
# -r requirements/base.txt
# google-auth
ruamel-yaml==0.18.6
# via -r requirements/base.txt
ruamel-yaml-clib==0.2.8
# via
# -r requirements/base.txt
# ruamel-yaml
secretstorage==3.3.3
# via keyring
six==1.16.0
Expand Down
3 changes: 1 addition & 2 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ packaging==24.0
# via build
pip-tools==7.4.1
# via -r requirements/pip-tools.in
pyproject-hooks==1.0.0
pyproject-hooks==1.1.0
# via
# build
# pip-tools
tomli==2.0.1
# via
# build
# pip-tools
# pyproject-hooks
wheel==0.43.0
# via pip-tools
zipp==3.18.1
Expand Down
4 changes: 2 additions & 2 deletions tutoraspects/asset_command_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Helpers for Tutor commands and "do" commands.
"""

from zipfile import ZipFile
import glob
import os
import re
import yaml
from zipfile import ZipFile

import click
import yaml

FILE_NAME_ATTRIBUTE = "_file_name"

Expand Down
1 change: 0 additions & 1 deletion tutoraspects/commands_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import click
from tutor import config as tutor_config

from tutor import env


Expand Down
5 changes: 2 additions & 3 deletions tutoraspects/commands_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
import sys

import click

from tutor import env

from tutoraspects.asset_command_helpers import (
SupersetCommandError,
check_asset_names,
check_orphan_assets,
import_superset_assets,
deduplicate_superset_assets,
SupersetCommandError,
import_superset_assets,
)


Expand Down
6 changes: 2 additions & 4 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@

from .__about__ import __version__
from .commands_v0 import COMMANDS as TUTOR_V0_COMMANDS
from .commands_v1 import (
DO_COMMANDS as TUTOR_V1_DO_COMMANDS,
COMMANDS as TUTOR_V1_COMMANDS,
)
from .commands_v1 import COMMANDS as TUTOR_V1_COMMANDS
from .commands_v1 import DO_COMMANDS as TUTOR_V1_DO_COMMANDS

########################################
# CONFIGURATION
Expand Down
10,439 changes: 5,781 additions & 4,658 deletions tutoraspects/templates/aspects/build/aspects-superset/localization/locale.yaml

Large diffs are not rendered by default.

Empty file.
13 changes: 9 additions & 4 deletions scripts/translate.py → tutoraspects/translations/translate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import os
"""Interface for the translations."""

import sys

import click
from translate_utils import compile_translations, extract_translations, get_text_for_translations
from tutoraspects.translations.translate_utils import (
compile_translations,
extract_translations,
get_text_for_translations,
)


@click.command()
Expand All @@ -17,9 +22,9 @@ def command(root, action):
elif action == "list":
get_text_for_translations(root)
else:
print("Unknown action: {}".format(action))
print(f"Unknown action: {action}")
sys.exit(1)


if __name__ == "__main__":
command()
command() # pylint: disable=no-value-for-parameter
Loading

0 comments on commit 225b57f

Please sign in to comment.