Make WordPress Core

Changeset 6589


Ignore:
Timestamp:
01/10/2008 05:28:50 PM (17 years ago)
Author:
ryan
Message:

phpdoc for locale from darkdragon. fixes #5621

File:
1 edited

Legend:

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

    r6033 r6589  
    11<?php
    2 
    3 // Date and Time
    4 
     2/**
     3 * Date and Time Locale object
     4 *
     5 * @package WordPress
     6 * @subpackage i18n
     7 */
     8
     9/**
     10 * {@internal Missing Short Description}}
     11 *
     12 * {@internal Missing Long Description}}
     13 *
     14 * @since 2.1.0
     15 */
    516class WP_Locale {
     17    /**
     18     * Stores the translated strings for the full weekday names.
     19     *
     20     * @since 2.1.0
     21     * @var array
     22     * @access private
     23     */
    624    var $weekday;
     25
     26    /**
     27     * Stores the translated strings for the one character weekday names.
     28     *
     29     * There is a hack to make sure that Tuesday and Thursday, as well
     30     * as Sunday and Saturday don't conflict. See init() method for more.
     31     *
     32     * @see WP_Locale::init() for how to handle the hack.
     33     *
     34     * @since 2.1.0
     35     * @var array
     36     * @access private
     37     */
    738    var $weekday_initial;
     39
     40    /**
     41     * Stores the translated strings for the abbreviated weekday names.
     42     *
     43     * @since 2.1.0
     44     * @var array
     45     * @access private
     46     */
    847    var $weekday_abbrev;
    948
     49    /**
     50     * Stores the translated strings for the full month names.
     51     *
     52     * @since 2.1.0
     53     * @var array
     54     * @access private
     55     */
    1056    var $month;
     57
     58    /**
     59     * Stores the translated strings for the abbreviated month names.
     60     *
     61     * @since 2.1.0
     62     * @var array
     63     * @access private
     64     */
    1165    var $month_abbrev;
    1266
     67    /**
     68     * Stores the translated strings for 'am' and 'pm'.
     69     *
     70     * Also the capalized versions.
     71     *
     72     * @since 2.1.0
     73     * @var array
     74     * @access private
     75     */
    1376    var $meridiem;
    1477
     78    /**
     79     * The text direction of the locale language.
     80     *
     81     * Default is left to right 'ltr'.
     82     *
     83     * @since 2.1.0
     84     * @var string
     85     * @access private
     86     */
    1587    var $text_direction = 'ltr';
     88
     89    /**
     90     * Imports the global version to the class property.
     91     *
     92     * @since 2.1.0
     93     * @var array
     94     * @access private
     95     */
    1696    var $locale_vars = array('text_direction');
    1797
     98    /**
     99     * Sets up the translated strings and object properties.
     100     *
     101     * The method creates the translatable strings for various
     102     * calendar elements. Which allows for specifying locale
     103     * specific calendar names and text direction.
     104     *
     105     * @since 2.1.0
     106     * @access private
     107     */
    18108    function init() {
    19109        // The Weekdays
     
    108198    }
    109199
     200    /**
     201     * Retrieve the full translated weekday word.
     202     *
     203     * Week starts on translated Sunday and can be fetched
     204     * by using 0 (zero). So the week starts with 0 (zero)
     205     * and ends on Saturday with is fetched by using 6 (six).
     206     *
     207     * @since 2.1.0
     208     * @access public
     209     *
     210     * @param int $weekday_number 0 for Sunday through 6 Saturday
     211     * @return string Full translated weekday
     212     */
    110213    function get_weekday($weekday_number) {
    111214        return $this->weekday[$weekday_number];
    112215    }
    113216
     217    /**
     218     * Retrieve the translated weekday initial.
     219     *
     220     * The weekday initial is retrieved by the translated
     221     * full weekday word. When translating the weekday initial
     222     * pay attention to make sure that the starting letter does
     223     * not conflict.
     224     *
     225     * @since 2.1.0
     226     * @access public
     227     *
     228     * @param string $weekday_name
     229     * @return string
     230     */
    114231    function get_weekday_initial($weekday_name) {
    115232        return $this->weekday_initial[$weekday_name];
    116233    }
    117234
     235    /**
     236     * Retrieve the translated weekday abbreviation.
     237     *
     238     * The weekday abbreviation is retrieved by the translated
     239     * full weekday word.
     240     *
     241     * @since 2.1.0
     242     * @access public
     243     *
     244     * @param string $weekday_name Full translated weekday word
     245     * @return string Translated weekday abbreviation
     246     */
    118247    function get_weekday_abbrev($weekday_name) {
    119248        return $this->weekday_abbrev[$weekday_name];
    120249    }
    121250
     251    /**
     252     * Retrieve the full translated month by month number.
     253     *
     254     * The $month_number parameter has to be a string
     255     * because it must have the '0' in front of any number
     256     * that is less than 10. Starts from '01' and ends at
     257     * '12'.
     258     *
     259     * You can use an integer instead and it will add the
     260     * '0' before the numbers less than 10 for you.
     261     *
     262     * @since 2.1.0
     263     * @access public
     264     *
     265     * @param string|int $month_number '01' through '12'
     266     * @return string Translated full month name
     267     */
    122268    function get_month($month_number) {
    123269        return $this->month[zeroise($month_number, 2)];
    124270    }
    125271
    126     function get_month_initial($month_name) {
    127         return $this->month_initial[$month_name];
    128     }
    129 
     272    /**
     273     * Retrieve translated version of month abbreviation string.
     274     *
     275     * The $month_name parameter is expected to be the translated or
     276     * translatable version of the month.
     277     *
     278     * @since 2.1.0
     279     * @access public
     280     *
     281     * @param string $month_name Translated month to get abbreviated version
     282     * @return string Translated abbreviated month
     283     */
    130284    function get_month_abbrev($month_name) {
    131285        return $this->month_abbrev[$month_name];
    132286    }
    133287
     288    /**
     289     * Retrieve translated version of meridiem string.
     290     *
     291     * The $meridiem parameter is expected to not be translated.
     292     *
     293     * @since 2.1.0
     294     * @access public
     295     *
     296     * @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version.
     297     * @return string Translated version
     298     */
    134299    function get_meridiem($meridiem) {
    135300        return $this->meridiem[$meridiem];
    136301    }
    137302
    138     // Global variables are deprecated. For backwards compatibility only.
     303    /**
     304     * Global variables are deprecated. For backwards compatibility only.
     305     *
     306     * @deprecated For backwards compatibility only.
     307     * @access private
     308     *
     309     * @since 2.1.0
     310     */
    139311    function register_globals() {
    140312        $GLOBALS['weekday']         = $this->weekday;
     
    145317    }
    146318
     319    /**
     320     * PHP4 style constructor which calls helper methods to set up object variables
     321     *
     322     * @uses WP_Locale::init()
     323     * @uses WP_Locale::register_globals()
     324     * @since 2.1.0
     325     *
     326     * @return WP_Locale
     327     */
    147328    function WP_Locale() {
    148329        $this->init();
Note: See TracChangeset for help on using the changeset viewer.