MediaWiki fundraising/REL1_35
|
A class for querying translated time units from CLDR data. More...
Static Public Member Functions | |
static | getUnits ( $code) |
Get localized time units for a particular language, using fallback languages for missing items. | |
static | onGetHumanTimestamp (&$output, $timestamp, $relativeTo, $user, $lang) |
Handler for GetHumanTimestamp hook. | |
Static Public Member Functions inherited from CldrNames | |
static | getFileName ( $code) |
Get the name for the file that contains the CLDR data for a given language. | |
static | getOverrideFileName ( $code) |
Get the name for the file that contains the local override data for a given language. | |
Static Private Member Functions | |
static | loadLanguage ( $code) |
Load time units localized for a particular language. | |
Static Private Attributes | |
static | $cache = [] |
A class for querying translated time units from CLDR data.
Definition at line 11 of file TimeUnits.php.
|
static |
Get localized time units for a particular language, using fallback languages for missing items.
The time units are returned as an associative array. The keys are of the form: <unit>-<tense>-<ordinality> (for example, 'hour-future-two'). The values include a placeholder for the number (for example, '{0} months ago').
string | $code | The language to return the list in |
Definition at line 24 of file TimeUnits.php.
References $fallback, and loadLanguage().
Referenced by onGetHumanTimestamp().
|
staticprivate |
Load time units localized for a particular language.
Helper function for getUnits.
string | $code | The language to return the list in |
Definition at line 50 of file TimeUnits.php.
References $timeUnits, CldrNames\getFileName(), CldrNames\getOverrideFileName(), and wfDebug().
Referenced by getUnits().
|
static |
Handler for GetHumanTimestamp hook.
Converts the given time into a human-friendly relative format, for example, '6 days ago', 'In 10 months'.
string | &$output | The output timestamp |
MWTimestamp | $timestamp | The current (user-adjusted) timestamp |
MWTimestamp | $relativeTo | The relative (user-adjusted) timestamp |
User | $user | User whose preferences are being used to make timestamp |
Language | $lang | Language that will be used to render the timestamp |
Definition at line 96 of file TimeUnits.php.
References $lang, $timeUnits, getUnits(), and wfMessage().
|
staticprivate |
Definition at line 13 of file TimeUnits.php.