Make WordPress Core

Changeset 1286


Ignore:
Timestamp:
05/16/2004 05:07:13 PM (21 years ago)
Author:
rboren
Message:

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.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/locale.php

    r1086 r1286  
    1010$weekday[5] = __('Friday');
    1111$weekday[6] = __('Saturday');
     12
     13// The first letter of each day.  Note that marking single characters for
     14// translation is useless, but here it is.
     15$weekday_initial['Sunday']    = __('S');
     16$weekday_initial['Monday']    = __('M');
     17$weekday_initial['Tuesday']   = __('T');
     18$weekday_initial['Wednesday'] = __('W');
     19$weekday_initial['Thursday']  = __('T');
     20$weekday_initial['Friday']    = __('F');
     21$weekday_initial['Saturday']  = __('S');
     22
     23// Abbreviations for each day.
     24$weekday_abbrev['Sunday']    = __('Sun');
     25$weekday_abbrev['Monday']    = __('Mon');
     26$weekday_abbrev['Tuesday']   = __('Tue');
     27$weekday_abbrev['Wednesday'] = __('Wed');
     28$weekday_abbrev['Thursday']  = __('Thu');
     29$weekday_abbrev['Friday']    = __('Fri');
     30$weekday_abbrev['Saturday']  = __('Sat');
    1231
    1332// The Months
     
    2443$month['11'] = __('November');
    2544$month['12'] = __('December');
     45
     46// Abbreviations for each month.
     47$month_abbrev['January'] = __('Jan');
     48$month_abbrev['February'] = __('Feb');
     49$month_abbrev['March'] = __('Mar');
     50$month_abbrev['April'] = __('Apr');
     51$month_abbrev['May'] = __('May');
     52$month_abbrev['June'] = __('Jun');
     53$month_abbrev['July'] = __('Jul');
     54$month_abbrev['August'] = __('Aug');
     55$month_abbrev['September'] = __('Sep');
     56$month_abbrev['October'] = __('Oct');
     57$month_abbrev['November'] = __('Nov');
     58$month_abbrev['December'] = __('Dec');
    2659?>
  • trunk/wp-includes/template-functions-general.php

    r1239 r1286  
    308308
    309309function get_calendar($daylength = 1) {
    310     global $wpdb, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts;
     310    global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $tableposts, $posts;
    311311
    312312    // Quick check. If we have no posts at all, abort!
     
    368368    <thead>
    369369    <tr>';
     370
     371    $day_abbrev = $weekday_initial;
     372    if ($daylength > 1) {
     373        $day_abbrev = $weekday_abbrev;
     374    }
     375
    370376    foreach ($weekday as $wd) {
    371         echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">" . substr($wd, 0, $daylength) . '</th>';
     377        echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">" . $day_abbrev[$wd] . '</th>';
    372378    }
    373379
     
    381387    if ($previous) {
    382388        echo "\n\t\t".'<td abbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' .
    383                 get_month_link($previous->year, $previous->month) . '" title="View posts for ' . $month[zeroise($previous->month, 2)] . ' ' .
    384                 date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">&laquo; ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a></td>';
     389            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>';
    385390    } else {
    386391        echo "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
Note: See TracChangeset for help on using the changeset viewer.