(bug 28643) Merge Serbian language variant conversion improvements to trunk (r85224...
[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 $ts = wfTimestamp( TS_MW, $ts );
29 if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
30 $datePreference = $this->dateFormat( $format );
31
32 # ISO (YYYY-mm-dd) format
33 #
34 # we also output this format for YMD (eg: 2001 January 15)
35 if ( $datePreference == 'ISO 8601' ) {
36 $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 );
37 return $d;
38 }
39
40 # dd/mm/YYYY format
41 if ( $datePreference == 'walloon short' ) {
42 $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 );
43 return $d;
44 }
45
46 # Walloon format
47 #
48 # we output this in all other cases
49 $m = substr( $ts, 4, 2 );
50 $n = substr( $ts, 6, 2 );
51 if ( $n == 1 ) {
52 $d = "1î d' " . $this->getMonthName( $m ) .
53 " " . substr( $ts, 0, 4 );
54 } else if ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
55 $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
56 " " . substr( $ts, 0, 4 );
57 } else if ( $m == 4 || $m == 8 || $m == 10 ) {
58 $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
59 " " . substr( $ts, 0, 4 );
60 } else {
61 $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) .
62 " " . substr( $ts, 0, 4 );
63 }
64 return $d;
65 }
66
67 function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
68 if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
69 $datePreference = $this->dateFormat( $format );
70 if ( $datePreference == 'ISO 8601' ) {
71 return parent::timeanddate( $ts, $adj, $format, $tc );
72 } else {
73 return $this->date( $ts, $adj, $format, $tc ) . ' a ' .
74 $this->time( $ts, $adj, $format, $tc );
75 }
76 }
77 }