X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FMWTimestamp.php;h=102be801828a9652577c2b15fade31c051ef262b;hb=ddbba62d03e8d5d586d73a20cbc6544b41c574a6;hp=d28f88e5049e6bf6d7aa9696cdef8564b656cbbf;hpb=6d79d853b17dc45b8b4796e89d930f95f75e7216;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MWTimestamp.php b/includes/MWTimestamp.php index d28f88e504..102be80182 100644 --- a/includes/MWTimestamp.php +++ b/includes/MWTimestamp.php @@ -106,7 +106,7 @@ class MWTimestamp { $ts, $da ) ) { - #TS_ISO_8601_BASIC + # TS_ISO_8601_BASIC } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d*[\+\- ](\d\d)$/', $ts, @@ -367,6 +367,26 @@ class MWTimestamp { return $this->timestamp->getTimezone(); } + /** + * Get the localized timezone message, if available. + * + * Premade translations are not shipped as format() may return whatever the + * system uses, localized or not, so translation must be done through wiki. + * + * @since 1.25 + * @return Message The localized timezone message + */ + public function getTimezoneMessage() { + $tzMsg = $this->format( 'T' ); // might vary on DST changeover! + $key = 'timezone-' . strtolower( trim( $tzMsg ) ); + $msg = wfMessage( $key ); + if ( $msg->exists() ) { + return $msg; + } else { + return new RawMessage( $tzMsg ); + } + } + /** * Format the timestamp in a given format. *