openedx / edx-platform

The Open edX LMS & Studio, powering education sites around the world!
https://openedx.org
GNU Affero General Public License v3.0
7.1k stars 3.79k forks source link

Assignment's Due Date translation - Only part of the string is being translated #34951

Open Rodra opened 1 month ago

Rodra commented 1 month ago

Conditions

The conditions required to trigger the bug are:

When changing the Site Language through the user preferences page image

The Due Date should be translated accordingly but only the word Due is translated. The subsection_format and date remain in the same language.

Screenshot 2024-06-07 at 3 41 21 PM Screenshot 2024-06-07 at 3 41 57 PM

Expected Results

Screenshot 2024-06-07 at 3 46 31 PM Screenshot 2024-06-07 at 3 47 04 PM

Trace

Django Template line of code that renders the Due Date Due Date rendered in template

Dates for the unit are handled by custom JS: https://github.com/openedx/edx-platform/blob/master/lms/static/js/dateutil_factory.js . We currently localize the date format but not the actual date (i.e. based on the locale, we might get any of the following formats):

2018, 01 Jan 15:30 UTC
Jan 01, 2018 15:30 UTC
01 Jan, 2018 15:30 UTC
2018, Jan 01 15:30 UTC

But this part of the string along with the subsection_format are never sent through translation.

Suggestion

Changing the order of translation (format string, THEN translate instead of translate THEN format) would fix the issue.