diff --git a/common/djangoapps/util/date_utils.py b/common/djangoapps/util/date_utils.py index 968fb55d7cda..377d7131983c 100644 --- a/common/djangoapps/util/date_utils.py +++ b/common/djangoapps/util/date_utils.py @@ -104,6 +104,70 @@ def from_timestamp(timestamp): DEFAULT_TIME_FORMAT = "%I:%M:%S %p" DEFAULT_DATE_TIME_FORMAT = "%b %d, %Y at %H:%M" DEFAULT_DAY_AND_TIME_FORMAT = "%A at %-I%P" +arabic_numbers = { + "0": "٠", + "1": "١", + "2": "٢", + "3": "٣", + "4": "٤", + "5": "٥", + "6": "٦", + "7": "٧", + "8": "٨", + "9": "٩", +} +comma_sign_arabic = "،" +english_months_list = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", +] +urdu_months_list = [ + "جنوری", + "فروری", + "مارچ", + "اپریل", + "مئی", + "جون", + "جولائی", + "اگست", + "ستمبر", + "اکتوبر", + "نومبر", + "دسمبر", +] + + +def convert_number_to_arabic(number): + if number.isnumeric(): + for digit in number: + if digit.isnumeric(): + number = number.replace(digit, arabic_numbers[digit]) + return number + + +def convert_date_to_arabic(date): + for char in date: + if char.isnumeric(): + date = date.replace(char, arabic_numbers[char]) + elif char == ",": + date = date.replace(char, comma_sign_arabic) + + for idx, month in enumerate(english_months_list): + if month in date: + date = date.replace(month, urdu_months_list[idx]) + break + + return date def strftime_localized(dtime, format): # pylint: disable=redefined-builtin diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index b859cfe92ca2..26ea2b104f9c 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -25,7 +25,7 @@ from common.djangoapps.edxmako.shortcuts import render_to_response from common.djangoapps.edxmako.template import Template from common.djangoapps.student.models import LinkedInAddToProfileConfiguration -from common.djangoapps.util.date_utils import strftime_localized +from common.djangoapps.util.date_utils import strftime_localized, convert_date_to_arabic, convert_number_to_arabic from common.djangoapps.util.views import handle_500 from lms.djangoapps.badges.events.course_complete import get_completion_badge from lms.djangoapps.badges.utils import badges_enabled @@ -124,7 +124,8 @@ def _update_certificate_context(context, course, course_overview, user_certifica else: date = display_date_for_certificate(course, user_certificate) # Translators: The format of the date includes the full name of the month - context['certificate_date_issued'] = strftime_localized(date, settings.CERTIFICATE_DATE_FORMAT) + date = strftime_localized(date, "%B %-d, %Y") + context['certificate_date_issued'] = convert_date_to_arabic(date) # Translators: This text represents the verification of the certificate context['document_meta_description'] = _('This is a valid {platform_name} certificate for {user_name}, ' @@ -243,10 +244,12 @@ def _update_context_with_basic_info(context, course_id, platform_name, configura ) -def _update_course_context(request, context, course, platform_name): +def _update_course_context(request, context, course, platform_name, course_overview): """ Updates context dictionary with course info. """ + effort = course_overview and course_overview.effort or '8' + context['course_duration'] = convert_number_to_arabic(effort) context['full_course_image_url'] = request.build_absolute_uri(course_image_url(course)) course_title_from_cert = context['certificate_data'].get('course_title', '') accomplishment_copy_course_name = course_title_from_cert if course_title_from_cert else course.display_name @@ -616,7 +619,7 @@ def render_html_view(request, course_id, certificate=None): # pylint: disable=t _update_organization_context(context, course) # Append course info - _update_course_context(request, context, course, platform_name) + _update_course_context(request, context, course, platform_name, course_overview) # Append course run info from discovery context.update(catalog_data) diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.eot b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.eot new file mode 100644 index 000000000000..b6158900af05 Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.eot differ diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.svg b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.svg new file mode 100644 index 000000000000..18ec96a98b10 --- /dev/null +++ b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.svg @@ -0,0 +1,2693 @@ + + + + +Created by FontForge 20190801 at Tue Oct 25 21:01:49 2011 + By Unknown +Copyright (c) 2008 - 2011 Linotype GmbH, www.linotype.com. All rights reserved. This font software may not be reproduced, modified, disclosed or transferred without the express written approval of Linotype GmbH. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.ttf b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.ttf new file mode 100644 index 000000000000..685062cbca75 Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.ttf differ diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.woff b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.woff new file mode 100644 index 000000000000..76cef7fbc434 Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.woff differ diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.woff2 b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.woff2 new file mode 100644 index 000000000000..3925a636775f Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Bold.woff2 differ diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.eot b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.eot new file mode 100644 index 000000000000..efc06f866428 Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.eot differ diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.svg b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.svg new file mode 100644 index 000000000000..ea9eb2814cfc --- /dev/null +++ b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.svg @@ -0,0 +1,2620 @@ + + + + +Created by FontForge 20190801 at Tue Aug 2 21:50:56 2011 + By Unknown +Copyright (c) 2008 - 2011 Linotype GmbH, www.linotype.com. All rights reserved. This font software may not be reproduced, modified, disclosed or transferred without the express written approval of Linotype GmbH. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.ttf b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.ttf new file mode 100644 index 000000000000..96f84a8330b3 Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.ttf differ diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.woff b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.woff new file mode 100644 index 000000000000..e23931fd2fcd Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.woff differ diff --git a/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.woff2 b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.woff2 new file mode 100644 index 000000000000..74191c2e0373 Binary files /dev/null and b/lms/static/sdaia_css/fonts/DIN-Next-LT-Arabic-Medium.woff2 differ diff --git a/lms/static/sdaia_css/styles.css b/lms/static/sdaia_css/styles.css index 4231f051287b..62c8e6612612 100644 --- a/lms/static/sdaia_css/styles.css +++ b/lms/static/sdaia_css/styles.css @@ -1,21 +1,21 @@ @font-face { font-family: 'DIN Next LT Arabic'; - src: url('../fonts/DIN-Next-LT-Arabic-Medium.woff2') format('woff2'), - url('../fonts/DIN-Next-LT-Arabic-Medium.woff') format('woff'), - url('../fonts/DIN-Next-LT-Arabic-Medium.ttf') format('truetype'), - url('../fonts/DIN-Next-LT-Arabic-Medium.eot') format('truetype'), - url('../fonts/DIN-Next-LT-Arabic-Medium.svg#din-next-lt-arabic-medium') format('svg'); + src: url('./fonts/DIN-Next-LT-Arabic-Medium.woff2') format('woff2'), + url('./fonts/DIN-Next-LT-Arabic-Medium.woff') format('woff'), + url('./fonts/DIN-Next-LT-Arabic-Medium.ttf') format('truetype'), + url('./fonts/DIN-Next-LT-Arabic-Medium.eot') format('truetype'), + url('./fonts/DIN-Next-LT-Arabic-Medium.svg#din-next-lt-arabic-medium') format('svg'); font-weight: 500; font-style: normal; } @font-face { font-family: 'DIN Next LT Arabic'; - src: url('../fonts/DIN-Next-LT-Arabic-Bold.woff2') format('woff2'), - url('../fonts/DIN-Next-LT-Arabic-Bold.woff') format('woff'), - url('../fonts/DIN-Next-LT-Arabic-Bold.ttf') format('truetype'), - url('../fonts/DIN-Next-LT-Arabic-Bold.eot') format('truetype'), - url('../fonts/DIN-Next-LT-Arabic-Bold.svg#din-next-lt-arabic-bold') format('svg'); + src: url('./fonts/DIN-Next-LT-Arabic-Bold.woff2') format('woff2'), + url('./fonts/DIN-Next-LT-Arabic-Bold.woff') format('woff'), + url('./fonts/DIN-Next-LT-Arabic-Bold.ttf') format('truetype'), + url('./fonts/DIN-Next-LT-Arabic-Bold.eot') format('truetype'), + url('./fonts/DIN-Next-LT-Arabic-Bold.svg#din-next-lt-arabic-bold') format('svg'); font-weight: 700; font-style: normal; } @@ -126,7 +126,7 @@ body { } .certificate-main .main-title { - margin: 0 0 93px; + margin: 0 0 34px; } .certificate-main .sub-title { diff --git a/lms/templates/certificates/_accomplishment-rendering.html b/lms/templates/certificates/_accomplishment-rendering.html index fcba8d834d56..bda7dd167ba4 100644 --- a/lms/templates/certificates/_accomplishment-rendering.html +++ b/lms/templates/certificates/_accomplishment-rendering.html @@ -27,9 +27,10 @@

شهادة إتمام

: الهيئة السعودية للبيانات والذكاء الاصطناعي ( سدايا ) تمنح

+

${accomplishment_copy_name}

هذه الشهادة وذلك لإتمام البرنامج التدريبي

-

سياسة حوكمة البيانات الوطنية

-

ومدته8 ساعات تدريبية بتاريخ

+

${accomplishment_copy_course_name}

+

ومدته${course_duration} ساعات تدريبية بتاريخ ${certificate_date_issued}

مع تمنياتنا بدوام التوفيق والنجاح

أكاديمية سدايا