From 2646858cad2c4ec8ae47c16d381ef28901897164 Mon Sep 17 00:00:00 2001 From: jportela Date: Wed, 5 Apr 2017 15:40:20 +0000 Subject: [PATCH 1/5] Add i18n to date in certificate web --- lms/djangoapps/certificates/views/webview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index 134807d6ba..b4d8cc3412 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -98,7 +98,7 @@ def _update_certificate_context(context, user_certificate, platform_name): # Translators: The format of the date includes the full name of the month context['certificate_date_issued'] = _('{month} {day}, {year}').format( - month=user_certificate.modified_date.strftime("%B"), + month=_(user_certificate.modified_date.strftime("%B")), day=user_certificate.modified_date.day, year=user_certificate.modified_date.year ) From b841176e9c9990d5554ef43b9e21bcabe4cadf9a Mon Sep 17 00:00:00 2001 From: jportela Date: Fri, 4 Aug 2017 14:27:43 +0200 Subject: [PATCH 2/5] Add i18n month dict to certificate using @amangano-edx solution in PR #14836 --- lms/djangoapps/certificates/views/webview.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index b4d8cc3412..f96b4eca9d 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -97,8 +97,26 @@ def _update_certificate_context(context, user_certificate, platform_name): ) # Translators: The format of the date includes the full name of the month + MONTHS={ + 'january': _('January'), + 'february': _('February'), + 'march': _('March'), + 'april': _('April'), + 'may': _('Mayy'), + 'june': _('June'), + 'july': _('July'), + 'august': _('August'), + 'september': _('September'), + 'october': _('October'), + 'november': _('November'), + 'december': _('December') + } + + def getTranslatedMonth(month): + return MONTHS[month.lower()] + context['certificate_date_issued'] = _('{month} {day}, {year}').format( - month=_(user_certificate.modified_date.strftime("%B")), + month=getTranslatedMonth(user_certificate.modified_date.strftime("%B")), day=user_certificate.modified_date.day, year=user_certificate.modified_date.year ) From a35e97445775bdbe4461ebd4c13c97178c35f5c7 Mon Sep 17 00:00:00 2001 From: jportela Date: Fri, 4 Aug 2017 14:31:55 +0200 Subject: [PATCH 3/5] Fix typo introduced in commit b841176 --- lms/djangoapps/certificates/views/webview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index f96b4eca9d..d330c61aeb 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -102,7 +102,7 @@ def _update_certificate_context(context, user_certificate, platform_name): 'february': _('February'), 'march': _('March'), 'april': _('April'), - 'may': _('Mayy'), + 'may': _('May'), 'june': _('June'), 'july': _('July'), 'august': _('August'), From 54a26cfff42ab5eb602bbd2622f3b1f7a4e666e3 Mon Sep 17 00:00:00 2001 From: jportela Date: Fri, 4 Aug 2017 17:38:51 +0200 Subject: [PATCH 4/5] Add i18n month with strftime_localized in certificate views --- lms/djangoapps/certificates/views/webview.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index d330c61aeb..0204ff8565 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -97,26 +97,8 @@ def _update_certificate_context(context, user_certificate, platform_name): ) # Translators: The format of the date includes the full name of the month - MONTHS={ - 'january': _('January'), - 'february': _('February'), - 'march': _('March'), - 'april': _('April'), - 'may': _('May'), - 'june': _('June'), - 'july': _('July'), - 'august': _('August'), - 'september': _('September'), - 'october': _('October'), - 'november': _('November'), - 'december': _('December') - } - - def getTranslatedMonth(month): - return MONTHS[month.lower()] - context['certificate_date_issued'] = _('{month} {day}, {year}').format( - month=getTranslatedMonth(user_certificate.modified_date.strftime("%B")), + month=strftime_localized(user_certificate.modified_date,"%B"), day=user_certificate.modified_date.day, year=user_certificate.modified_date.year ) From 1ff5333bc072169a8f2736a0f9751d5a3a30adbb Mon Sep 17 00:00:00 2001 From: pepeportela Date: Fri, 4 Aug 2017 18:16:39 +0200 Subject: [PATCH 5/5] Add space between arguments --- lms/djangoapps/certificates/views/webview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index 0204ff8565..f0f15d517b 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -98,7 +98,7 @@ def _update_certificate_context(context, user_certificate, platform_name): # Translators: The format of the date includes the full name of the month context['certificate_date_issued'] = _('{month} {day}, {year}').format( - month=strftime_localized(user_certificate.modified_date,"%B"), + month=strftime_localized(user_certificate.modified_date, "%B"), day=user_certificate.modified_date.day, year=user_certificate.modified_date.year )