I have a view that expose a date filter with date_popup widget and using format 'd M Y' that I override through $date_element['#date_format'] = 'd M Y'. However an element with same format could be generated using the date element in a custom form array.

The problem with abbreviated dates is that the function date_month_names_abbr() call t() function without context when $length == 3 we need to consider that some months as "May" has the same full and abbreviated name. The length condition cause that for May the t() call with abbreviation context is never called. For a multilang site that context is very important because for example: in spanish May => Mayo (full name) and May => May (abbr name) so there is no way to correctly configure the translated name and date_month_names_abbr() returns wrong results:

Array (
[] =>
[Ene] => 1
[Feb] => 2
[Mar] => 3
[Abr] => 4
[Mayo] => 5
[Jun] => 6
[Jul] => 7
[Ago] => 8
[Sep] => 9
[Oct] => 10
[Nov] => 11
[Dic] => 12
)

Same thing happens for date_format_date() function that in the case of 'M' option in the format that should pass the abbreviation context to the t() function is calling to general translation.

I renenamed the context from simply "month_abbr" to "Abbreviation month name" for consistency compared to the other context "Long month name".

Files: 
CommentFileSizeAuthor
#1 1892898-fix-abbreviated-months-name-translation.patch1.86 KBcitlacom
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1892898-fix-abbreviated-months-name-translation.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Component:Code» Date API
Status:Active» Needs review
StatusFileSize
new1.86 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1892898-fix-abbreviated-months-name-translation.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Here is a patch that resolved the problem.

Status:Needs review» Needs work

The last submitted patch, 1892898-fix-abbreviated-months-name-translation.patch, failed testing.