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