Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / languages / classes / LanguageWa.php
blob078b068242cdcf0bed43e552b44d5b869710150e
1 <?php
2 /**
3 * Walloon (Walon) specific code.
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.
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.
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
20 * @file
21 * @ingroup Language
24 /**
25 * Walloon (Walon)
27 * NOTE: cweri après "NOTE:" po des racsegnes so des ratournaedjes
28 * k' i gn a.
30 * @ingroup Language
32 class LanguageWa extends Language {
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
39 * @param string $ts
40 * @param bool $adj
41 * @param bool $format
42 * @param bool $tc
43 * @return string
45 public function date( $ts, $adj = false, $format = true, $tc = false ) {
46 $ts = wfTimestamp( TS_MW, $ts );
47 if ( $adj ) {
48 $ts = $this->userAdjust( $ts, $tc );
50 $datePreference = $this->dateFormat( $format );
52 # ISO (YYYY-mm-dd) format
53 # we also output this format for YMD (eg: 2001 January 15)
54 if ( $datePreference == 'ISO 8601' ) {
55 $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 );
56 return $d;
59 # dd/mm/YYYY format
60 if ( $datePreference == 'walloon short' ) {
61 $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 );
62 return $d;
65 # Walloon format
66 # we output this in all other cases
67 $m = substr( $ts, 4, 2 );
68 $n = substr( $ts, 6, 2 );
69 if ( $n == 1 ) {
70 $d = "1î d' " . $this->getMonthName( $m ) .
71 " " . substr( $ts, 0, 4 );
72 } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
73 $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
74 " " . substr( $ts, 0, 4 );
75 } elseif ( $m == 4 || $m == 8 || $m == 10 ) {
76 $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
77 " " . substr( $ts, 0, 4 );
78 } else {
79 $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) .
80 " " . substr( $ts, 0, 4 );
82 return $d;
85 /**
86 * @param string $ts
87 * @param bool $adj
88 * @param bool $format
89 * @param bool $tc
90 * @return string
92 public function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
93 if ( $adj ) {
94 $ts = $this->userAdjust( $ts, $tc );
96 $datePreference = $this->dateFormat( $format );
97 if ( $datePreference == 'ISO 8601' ) {
98 return parent::timeanddate( $ts, $adj, $format, $tc );
99 } else {
100 return $this->date( $ts, $adj, $format, $tc ) . ' a ' .
101 $this->time( $ts, $adj, $format, $tc );