Skip to content

Commit

Permalink
refactor: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AfaqShuaib09 committed Mar 4, 2025
1 parent 8ec4eb8 commit 54f3c07
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def handle(self, *args, **options):
available_transcription_languages = ai_languages_data.get('transcription_languages', [])

# Remove any keys other than `code` and `label`
available_translation_languages = [{'code': lang['code'], 'label': lang['label']} for lang in available_translation_languages]
available_translation_languages = [
{'code': lang['code'], 'label': lang['label']} for lang in available_translation_languages
]

available_transcription_languages = [
{
Expand All @@ -92,13 +94,12 @@ def handle(self, *args, **options):
# Standardizing language codes to match between edx-val and course-discovery:
# - edx-val uses "zh_HANS", "zh_HANT", while course-discovery uses "zh-Hans", "zh-Hant".
# - edx-val uses "en-GB", whereas course-discovery uses "en-gb".
LanguageTag.objects.get(code__iexact=normalized_lang_code).name
if LanguageTag.objects.filter(code__iexact=normalized_lang_code).exists()
LanguageTag.objects.get(code__iexact=lang_code.replace("_", "-")).name
if LanguageTag.objects.filter(code__iexact=lang_code.replace("_", "-")).exists()
else ""
),
}
for lang_code in available_transcription_languages
if (normalized_lang_code := lang_code.replace("_", "-"))
]

course_run.ai_languages = {
Expand Down

0 comments on commit 54f3c07

Please sign in to comment.