[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/languages/classes/ -> LanguageWa.php (source)

   1  <?php
   2  /**
   3   * Walloon (Walon) specific code.
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License along
  16   * with this program; if not, write to the Free Software Foundation, Inc.,
  17   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18   * http://www.gnu.org/copyleft/gpl.html
  19   *
  20   * @file
  21   * @ingroup Language
  22   */
  23  
  24  /**
  25   * Walloon (Walon)
  26   *
  27   * NOTE: cweri après "NOTE:" po des racsegnes so des ratournaedjes
  28   * k' i gn a.
  29   *
  30   * @ingroup Language
  31   */
  32  class LanguageWa extends Language {
  33  
  34      /**
  35       * Dates in Walloon are "1î d' <monthname>" for 1st of the month,
  36       * "<day> di <monthname>" for months starting by a consoun, and
  37       * "<day> d' <monthname>" for months starting with a vowel
  38       *
  39       * @param string $ts
  40       * @param bool $adj
  41       * @param bool $format
  42       * @param bool $tc
  43       * @return string
  44       */
  45  	function date( $ts, $adj = false, $format = true, $tc = false ) {
  46          $ts = wfTimestamp( TS_MW, $ts );
  47          if ( $adj ) {
  48              $ts = $this->userAdjust( $ts, $tc );
  49          }
  50          $datePreference = $this->dateFormat( $format );
  51  
  52          # ISO (YYYY-mm-dd) format
  53          #
  54          # we also output this format for YMD (eg: 2001 January 15)
  55          if ( $datePreference == 'ISO 8601' ) {
  56              $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 );
  57              return $d;
  58          }
  59  
  60          # dd/mm/YYYY format
  61          if ( $datePreference == 'walloon short' ) {
  62              $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 );
  63              return $d;
  64          }
  65  
  66          # Walloon format
  67          #
  68          # we output this in all other cases
  69          $m = substr( $ts, 4, 2 );
  70          $n = substr( $ts, 6, 2 );
  71          if ( $n == 1 ) {
  72              $d = "1î d' " . $this->getMonthName( $m ) .
  73                  " " . substr( $ts, 0, 4 );
  74          } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
  75              $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
  76                  " " . substr( $ts, 0, 4 );
  77          } elseif ( $m == 4 || $m == 8 || $m == 10 ) {
  78              $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
  79                  " " . substr( $ts, 0, 4 );
  80          } else {
  81              $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) .
  82                  " " . substr( $ts, 0, 4 );
  83          }
  84          return $d;
  85      }
  86  
  87      /**
  88       * @param string $ts
  89       * @param bool $adj
  90       * @param bool $format
  91       * @param bool $tc
  92       * @return string
  93       */
  94  	function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
  95          if ( $adj ) {
  96              $ts = $this->userAdjust( $ts, $tc );
  97          }
  98          $datePreference = $this->dateFormat( $format );
  99          if ( $datePreference == 'ISO 8601' ) {
 100              return parent::timeanddate( $ts, $adj, $format, $tc );
 101          } else {
 102              return $this->date( $ts, $adj, $format, $tc ) . ' a ' .
 103                  $this->time( $ts, $adj, $format, $tc );
 104          }
 105      }
 106  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1