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:
- Clean drupal 8.6.1
- Modules: Language, Configuration Translation, Content Translation,Interface Translation
- Install second language (example; French).
- Allow content to be translated (and date field).
/admin/config/regional/content-language
- 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
- 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
- Update language translations (French).
/admin/reports/translations
- Using Interface Translation, search French Language for 'May' and set
May
to peux andMay with context: abbreviated month name
to mai./admin/config/regional/translate
- Modify basic page, add a date or timestamp field, and set the field display to the custom medium date format created in step 5.
- Create new basic page content and set date field to May 1, 2018.
- Translate the new basic page to French and set date field to May 1, 2018.
- 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