date_month_names_translated uses incorrect translation keys

emok - September 14, 2008 - 18:11
Project:Date
Version:6.x-2.x-dev
Component:Date API
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

date_month_names_translated, and thus date_t, fails to translate month names because it omits the '!long-month-name ' prefix.

I think the error was introduced during this committ: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/date/date_a...

The reason why '!long-month-name ' is necessary is explained in core's common.php#format_date: "May" is both a short and a long month name in English, but in order to translate it to languages where the number of characters varies some context-information (do we want a short or long name) is necessary. Thus Drupal core uses the convention with translation keys 'May', '!long-month-name May', 'Jun', '!long-month-name June' and so forth. The key 'June' does not normally exist in a standard installation's translation database, so when the current date_month_names_translated tries such translations they fail (unless some other module or user has added these non-standard translations too).

Patch is attached.

AttachmentSize
date_long_month_translation.diff1.02 KB

#1

KarenS - September 15, 2008 - 22:46
Status:needs review» fixed

Yes, I knew about this but for some reason had it in my head that the special formatting was for the short month names instead of the long month names. Patch committed, thanks!

#2

emok - September 21, 2008 - 21:04
Status:fixed» needs review

The patch got applied to date_month_names_untranslated rather than date_month_names_translated a few lines down. I guess there was a line number offset between the version that I rolled the patch on and version that you applied it on.
The mixup hower made me realize the amount of code could be reduced by reusing the untranslated array instead of redefining the same array in date_month_names_translated. Hopefully this patch should apply better since it covers both functions and thus should prevent a mixup.

AttachmentSize
date_long_month_translation2.diff 1.33 KB

#3

KarenS - September 26, 2008 - 12:26
Status:needs review» fixed

That wasn't your mistake, it was mine. I manually applied the patch to the wrong place :(

Thanks!

#4

Anonymous (not verified) - October 10, 2008 - 12:45
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.