Put day and month initials and abbreviations into locale.php so that they can be translated. Change get_calendar to use the locale abbreviations instead of doing substring operations.

git-svn-id: https://develop.svn.wordpress.org/trunk@1286 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2004-05-16 17:07:13 +00:00
parent ffd89ece14
commit 284f2bec21
2 changed files with 42 additions and 4 deletions

View File

@ -10,6 +10,25 @@ $weekday[4] = __('Thursday');
$weekday[5] = __('Friday');
$weekday[6] = __('Saturday');
// The first letter of each day. Note that marking single characters for
// translation is useless, but here it is.
$weekday_initial['Sunday'] = __('S');
$weekday_initial['Monday'] = __('M');
$weekday_initial['Tuesday'] = __('T');
$weekday_initial['Wednesday'] = __('W');
$weekday_initial['Thursday'] = __('T');
$weekday_initial['Friday'] = __('F');
$weekday_initial['Saturday'] = __('S');
// Abbreviations for each day.
$weekday_abbrev['Sunday'] = __('Sun');
$weekday_abbrev['Monday'] = __('Mon');
$weekday_abbrev['Tuesday'] = __('Tue');
$weekday_abbrev['Wednesday'] = __('Wed');
$weekday_abbrev['Thursday'] = __('Thu');
$weekday_abbrev['Friday'] = __('Fri');
$weekday_abbrev['Saturday'] = __('Sat');
// The Months
$month['01'] = __('January');
$month['02'] = __('February');
@ -23,4 +42,18 @@ $month['09'] = __('September');
$month['10'] = __('October');
$month['11'] = __('November');
$month['12'] = __('December');
// Abbreviations for each month.
$month_abbrev['January'] = __('Jan');
$month_abbrev['February'] = __('Feb');
$month_abbrev['March'] = __('Mar');
$month_abbrev['April'] = __('Apr');
$month_abbrev['May'] = __('May');
$month_abbrev['June'] = __('Jun');
$month_abbrev['July'] = __('Jul');
$month_abbrev['August'] = __('Aug');
$month_abbrev['September'] = __('Sep');
$month_abbrev['October'] = __('Oct');
$month_abbrev['November'] = __('Nov');
$month_abbrev['December'] = __('Dec');
?>

View File

@ -307,7 +307,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
function get_calendar($daylength = 1) {
global $wpdb, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts;
global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $tableposts, $posts;
// Quick check. If we have no posts at all, abort!
if (!$posts) {
@ -367,8 +367,14 @@ function get_calendar($daylength = 1) {
<caption>' . $month[zeroise($thismonth, 2)] . ' ' . date('Y', $unixmonth) . '</caption>
<thead>
<tr>';
$day_abbrev = $weekday_initial;
if ($daylength > 1) {
$day_abbrev = $weekday_abbrev;
}
foreach ($weekday as $wd) {
echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">" . substr($wd, 0, $daylength) . '</th>';
echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">" . $day_abbrev[$wd] . '</th>';
}
echo '
@ -380,8 +386,7 @@ function get_calendar($daylength = 1) {
if ($previous) {
echo "\n\t\t".'<td abbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' .
get_month_link($previous->year, $previous->month) . '" title="View posts for ' . $month[zeroise($previous->month, 2)] . ' ' .
date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">&laquo; ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a></td>';
get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $month[zeroise($previous->month, 2)], date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $month_abbrev[$month[zeroise($previous->month, 2)]] . '</a></td>';
} else {
echo "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
}