AA-590: pass translated tab titles to MFE

This commit is contained in:
Carla Duarte
2021-02-08 10:53:00 -05:00
parent 9dfd38bb2c
commit 00a025f073
2 changed files with 6 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ Course Home pages.
from django.urls import reverse
from django.utils.translation import ugettext as _
from rest_framework import serializers
@@ -18,7 +19,8 @@ class CourseTabSerializer(serializers.Serializer):
url = serializers.SerializerMethodField()
def get_title(self, tab):
return tab.title or tab.get('name', '')
title = tab.title or tab.get('name', '')
return _(title) # pylint: disable=translation-of-non-string
def get_url(self, tab):
request = self.context.get('request')

View File

@@ -8,6 +8,7 @@ from completion.exceptions import UnavailableCompletionData
from completion.utilities import get_key_to_last_completed_block
from django.conf import settings
from django.urls import reverse
from django.utils.translation import ugettext as _
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from opaque_keys import InvalidKeyError
@@ -168,8 +169,9 @@ class CoursewareMeta:
"""
tabs = []
for priority, tab in enumerate(get_course_tab_list(self.effective_user, self.overview)):
title = tab.title or tab.get('name', '')
tabs.append({
'title': tab.title or tab.get('name', ''),
'title': _(title), # pylint: disable=translation-of-non-string
'slug': tab.tab_id,
'priority': priority,
'type': tab.type,