4a4296cacff19f4f70bb3b2ab0da4e10d4fc3c0b
[lhc/web/wiklou.git] / languages / classes / LanguageWa.php
1 <?php
2 /**
3 * Walloon (Walon)
4 *
5 * @ingroup Language
6 */
7
8 # NOTE: cweri après "NOTE:" po des racsegnes so des ratournaedjes
9 # k' i gn a.
10
11 class LanguageWa extends Language {
12 /**
13 * Use singular form for zero
14 */
15 function convertPlural( $count, $forms ) {
16 if ( !count($forms) ) { return ''; }
17 $forms = $this->preConvertPlural( $forms, 2 );
18
19 return ($count <= 1) ? $forms[0] : $forms[1];
20 }
21
22 ###
23 ### Dates in Walloon are "1î d' <monthname>" for 1st of the month,
24 ### "<day> di <monthname>" for months starting by a consoun, and
25 ### "<day> d' <monthname>" for months starting with a vowel
26 ###
27 function date( $ts, $adj = false, $format = true, $tc = false ) {
28 if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
29 $datePreference = $this->dateFormat( $format );
30
31 # ISO (YYYY-mm-dd) format
32 #
33 # we also output this format for YMD (eg: 2001 January 15)
34 if ( $datePreference == 'ISO 8601' ) {
35 $d = substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
36 return $d;
37 }
38
39 # dd/mm/YYYY format
40 if ( $datePreference == 'walloon short' ) {
41 $d = substr($ts, 6, 2). '/' . substr($ts, 4, 2). '/' .substr($ts, 0, 4);
42 return $d;
43 }
44
45 # Walloon format
46 #
47 # we output this in all other cases
48 $m = substr( $ts, 4, 2 );
49 $n = substr( $ts, 6, 2 );
50 if ($n == 1) {
51 $d = "1î d' " . $this->getMonthName( $m ) .
52 " " . substr( $ts, 0, 4 );
53 } else if ($n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23) {
54 $d = (0 + $n) . " d' " . $this->getMonthName( $m ) .
55 " " . substr( $ts, 0, 4 );
56 } else if ($m == 4 || $m == 8 || $m == 10) {
57 $d = (0 + $n) . " d' " . $this->getMonthName( $m ) .
58 " " . substr( $ts, 0, 4 );
59 } else {
60 $d = (0 + $n) . " di " . $this->getMonthName( $m ) .
61 " " . substr( $ts, 0, 4 );
62 }
63 return $d;
64 }
65
66 function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
67 if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
68 $datePreference = $this->dateFormat( $format );
69 if ( $datePreference == 'ISO 8601' ) {
70 return parent::timeanddate( $ts, $adj, $format, $tc );
71 } else {
72 return $this->date( $ts, $adj, $format, $tc ) . ' a ' .
73 $this->time( $ts, $adj, $format, $tc );
74 }
75 }
76 }