Debian Codegraph @

includes/languages/LanguageWa.php

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