Merge "Call $wgContLang->findVariantLink() in {{PAGESINCATEGORY: }}"
[lhc/web/wiklou.git] / languages / classes / LanguageWa.php
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 * Use singular form for zero
35 *
36 * @param $count int
37 * @param $forms array
38 *
39 * @return string
40 */
41 function convertPlural( $count, $forms ) {
42 if ( !count( $forms ) ) {
43 return '';
44 }
45 $forms = $this->preConvertPlural( $forms, 2 );
46
47 return ( $count <= 1 ) ? $forms[0] : $forms[1];
48 }
49
50 /**
51 * Dates in Walloon are "1î d' <monthname>" for 1st of the month,
52 * "<day> di <monthname>" for months starting by a consoun, and
53 * "<day> d' <monthname>" for months starting with a vowel
54 *
55 * @param $ts string
56 * @param $adj bool
57 * @param $format bool
58 * @param $tc bool
59 * @return string
60 */
61 function date( $ts, $adj = false, $format = true, $tc = false ) {
62 $ts = wfTimestamp( TS_MW, $ts );
63 if ( $adj ) {
64 $ts = $this->userAdjust( $ts, $tc );
65 }
66 $datePreference = $this->dateFormat( $format );
67
68 # ISO (YYYY-mm-dd) format
69 #
70 # we also output this format for YMD (eg: 2001 January 15)
71 if ( $datePreference == 'ISO 8601' ) {
72 $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 );
73 return $d;
74 }
75
76 # dd/mm/YYYY format
77 if ( $datePreference == 'walloon short' ) {
78 $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 );
79 return $d;
80 }
81
82 # Walloon format
83 #
84 # we output this in all other cases
85 $m = substr( $ts, 4, 2 );
86 $n = substr( $ts, 6, 2 );
87 if ( $n == 1 ) {
88 $d = "1î d' " . $this->getMonthName( $m ) .
89 " " . substr( $ts, 0, 4 );
90 } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
91 $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
92 " " . substr( $ts, 0, 4 );
93 } elseif ( $m == 4 || $m == 8 || $m == 10 ) {
94 $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
95 " " . substr( $ts, 0, 4 );
96 } else {
97 $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) .
98 " " . substr( $ts, 0, 4 );
99 }
100 return $d;
101 }
102
103 /**
104 * @param $ts string
105 * @param $adj bool
106 * @param $format bool
107 * @param $tc bool
108 * @return string
109 */
110 function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
111 if ( $adj ) {
112 $ts = $this->userAdjust( $ts, $tc );
113 }
114 $datePreference = $this->dateFormat( $format );
115 if ( $datePreference == 'ISO 8601' ) {
116 return parent::timeanddate( $ts, $adj, $format, $tc );
117 } else {
118 return $this->date( $ts, $adj, $format, $tc ) . ' a ' .
119 $this->time( $ts, $adj, $format, $tc );
120 }
121 }
122 }