-
Notifications
You must be signed in to change notification settings - Fork 17
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: allow to translate dataset text on chart #648
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d6369e1
chore: enable superset hot-reload
Ian2012 02eae45
chore: omit more vars in charts
Ian2012 5081220
feat: allow to translate dataset text on chart
Ian2012 42c2df3
chore: mark dataset strings for translations
Ian2012 21de07d
fix: remove forced time_range filter on all charts
Ian2012 6f71c60
chore: allow to test against dev branches
Ian2012 859c901
fix: remove raw expression from clickhouse url
Ian2012 6eb71cc
chore: remove localization logging
Ian2012 4c8c1a7
fix: add SUPERSET_ENV variable
Ian2012 6cc6c2e
fix: use openedx api to get language preference
Ian2012 9541153
chore: quality fixes
Ian2012 55b96b0
fix: bimount assets and translations
Ian2012 2ad6530
fix: translate enrollment events
Ian2012 f567c9f
fix: return column_name when there is not column translation
Ian2012 b8d39af
fix: dev environment assets
Ian2012 86f8e76
fix: replace chart metrics with dataset metrics
Ian2012 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ name: Tutor Integration Test | |
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- .github/** | ||
- .ci/** | ||
|
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
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
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
33 changes: 33 additions & 0 deletions
33
tutoraspects/templates/aspects/apps/superset/pythonpath/localization.py
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,33 @@ | ||
""" | ||
This file is used to load translations from the locale.yaml file and provide a function to get translations | ||
""" | ||
|
||
import yaml | ||
|
||
TRANSLATIONS_FILE_PATH = "/app/localization/locale.yaml" | ||
DATASET_STRINGS_FILE_PATH = "/app/localization/datasets_strings.yaml" | ||
|
||
ASSETS_TRANSLATIONS = {} | ||
with open(TRANSLATIONS_FILE_PATH, "r") as file: | ||
yaml_content = file.read() | ||
yaml_documents = yaml_content.split("\n---\n") | ||
|
||
for doc in yaml_documents: | ||
data = yaml.safe_load(doc) | ||
if data is not None: | ||
for lang, translations in data.items(): | ||
if lang not in ASSETS_TRANSLATIONS: | ||
ASSETS_TRANSLATIONS[lang] = {} | ||
ASSETS_TRANSLATIONS[lang].update(translations) | ||
|
||
|
||
DATASET_STRINGS = yaml.safe_load(open(DATASET_STRINGS_FILE_PATH, "r")) | ||
|
||
|
||
def get_translation(text, language): | ||
"""Get a translation for a text in a language""" | ||
default_text = f"{text}" | ||
LANGUAGE = ASSETS_TRANSLATIONS.get(language, {}) | ||
if not LANGUAGE: | ||
return default_text | ||
return ASSETS_TRANSLATIONS.get(language, {}).get(text) or default_text |
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
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
2 changes: 1 addition & 1 deletion
2
tutoraspects/templates/aspects/apps/superset/scripts/import-assets.sh
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,4 +1,4 @@ | ||
|
||
mkdir -p /app/assets/ | ||
cd /app/assets/ | ||
rm -rf superset | ||
|
||
|
7 changes: 7 additions & 0 deletions
7
tutoraspects/templates/aspects/build/aspects-superset/localization/datasets_strings.yaml
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 @@ | ||
enrollment_mode: | ||
- audit | ||
- verified | ||
- honor | ||
enrollment_status: | ||
- registered | ||
- unregistered |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
--debug
flag meant to stay in?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this only will affect dev environment, local en k8s works the same as before.