--- includes/common.inc.ORIG 2008-04-07 08:43:55.000000000 +1000 +++ includes/common.inc 2008-04-07 21:43:37.000000000 +1000 @@ -1176,39 +1176,35 @@ function format_date($timestamp, $type = $format = variable_get('date_format_medium', 'D, m/d/Y - H:i'); } - $max = strlen($format); - $date = ''; - for ($i = 0; $i < $max; $i++) { - $c = $format[$i]; - if (strpos('AaDlM', $c) !== FALSE) { - $date .= t(gmdate($c, $timestamp), array(), $langcode); - } - else if ($c == 'F') { - // Special treatment for long month names: May is both an abbreviation - // and a full month name in English, but other languages have - // different abbreviations. - $date .= trim(t('!long-month-name '. gmdate($c, $timestamp), array('!long-month-name' => ''), $langcode)); - } - else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== FALSE) { - $date .= gmdate($c, $timestamp); - } - else if ($c == 'r') { - $date .= format_date($timestamp - $timezone, 'custom', 'D, d M Y H:i:s O', $timezone, $langcode); - } - else if ($c == 'O') { - $date .= sprintf('%s%02d%02d', ($timezone < 0 ? '-' : '+'), abs($timezone / 3600), abs($timezone % 3600) / 60); - } - else if ($c == 'Z') { - $date .= $timezone; - } - else if ($c == '\\') { - $date .= $format[++$i]; - } - else { - $date .= $c; + // Replace entries in $format string which need to be translated + // with escaped string '+=X=+', where X is a format specifier which + // requires translation. The 'F' format specifier requires special + // handling because in English (for example) May is both a short and + // long month name. We need to specify for the 'F' format that it is + // the long month name we will be translating. + // These patterns specifically exclude any pattern specifier which has + // been prefixed with '\\' (octal 134). + + $format = preg_replace('@(? ''),$langcode),$date); + else + $date = str_replace("+=$a=+",t($a,array(),$langcode),$date); } } - return $date; }