Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
92.00% covered (success)
92.00%
23 / 25
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
LanguageWa
92.00% covered (success)
92.00%
23 / 25
50.00% covered (danger)
50.00%
1 / 2
16.13
0.00% covered (danger)
0.00%
0 / 1
 date
90.00% covered (success)
90.00%
18 / 20
0.00% covered (danger)
0.00%
0 / 1
13.17
 timeanddate
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
3
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/**
22 * Walloon (Walon)
23 *
24 * NOTE: cweri après "NOTE:" po des racsegnes so des ratournaedjes
25 * k' i gn a.
26 *
27 * @ingroup Languages
28 */
29class LanguageWa extends Language {
30
31    /**
32     * Dates in Walloon are "1î d' <monthname>" for 1st of the month,
33     * "<day> di <monthname>" for months starting by a consoun, and
34     * "<day> d' <monthname>" for months starting with a vowel
35     *
36     * @inheritDoc
37     */
38    public function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
39        $datePreference = $this->dateFormat( $format );
40        if ( $datePreference == 'ISO 8601' || $datePreference == 'walloon short' ) {
41            return parent::date( $ts, $adj, $format, $timecorrection );
42        }
43
44        $ts = wfTimestamp( TS_MW, $ts );
45        if ( $adj ) {
46            $ts = $this->userAdjust( $ts, $timecorrection );
47        }
48
49        # Walloon 'dmy' format
50        $m = (int)substr( $ts, 4, 2 );
51        $n = (int)substr( $ts, 6, 2 );
52        if ( $n == 1 ) {
53            $d = "1î d' " . $this->getMonthName( $m ) .
54                " " . substr( $ts, 0, 4 );
55        } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
56            $d = $n . " d' " . $this->getMonthName( $m ) .
57                " " . substr( $ts, 0, 4 );
58        } elseif ( $m == 4 || $m == 8 || $m == 10 ) {
59            $d = $n . " d' " . $this->getMonthName( $m ) .
60                " " . substr( $ts, 0, 4 );
61        } else {
62            $d = $n . " di " . $this->getMonthName( $m ) .
63                " " . substr( $ts, 0, 4 );
64        }
65        return $d;
66    }
67
68    public function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
69        $datePreference = $this->dateFormat( $format );
70        if ( $datePreference == 'ISO 8601' || $datePreference == 'walloon short' ) {
71            return parent::timeanddate( $ts, $adj, $format, $tc );
72        }
73
74        # Walloon 'dmy' format
75        return $this->date( $ts, $adj, $format, $tc ) . ' a ' .
76            $this->time( $ts, $adj, $format, $tc );
77    }
78}