Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295019

Date formats with abbreviated month name (M) are not translated using context.

$
0
0

Problem/Motivation

When creating or modifying a translated date format which uses the abbreviated month name (M), the translations (Jan, Feb, Mar, etc.) will not use the 'context' related interface translation.

For example, the French interface translation for 'May' should provide two source strings; May and May with context: abbreviated month name. Assume we translate May to peux and May with context to mai. All content date fields which uses the date format with the abbreviated month (M) will display the month of May as peux when it should be mai.

Steps to reproduce:

  1. Clean drupal 8.6.1
  2. Modules: Language, Configuration Translation, Content Translation,Interface Translation
  3. Install second language (example; French).
  4. Allow content to be translated (and date field). /admin/config/regional/content-language
  5. Date and time format; add custom medium date with abbreviated month (M). For example: Name=shortened_medium_date Format String= M d, y/admin/config/regional/date-time
  6. Add a French translation for the custom medium date. For example: Format String= d M, y/admin/config/regional/date-time/formats/manage/shortened_medium_date/translate
  7. Update language translations (French). /admin/reports/translations
  8. Using Interface Translation, search French Language for 'May' and set May to peux and May with context: abbreviated month name to mai. /admin/config/regional/translate
  9. Modify basic page, add a date or timestamp field, and set the field display to the custom medium date format created in step 5.
  10. Create new basic page content and set date field to May 1, 2018.
  11. Translate the new basic page to French and set date field to May 1, 2018.
  12. View the new page with /fr/. The date should be 1 mai, 2018 but it will be 1 peux, 2018.

Proposed resolution

Modify the DrupalDateTime format function to set context = Abbreviated month name when code = M.

Remaining tasks

  • Create patch. (Done)
  • Test.

User interface changes

none

API changes

none

Data model changes

none

Original report by [username]

none


Viewing all articles
Browse latest Browse all 295019

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>