4f9c4da3608dd91d66be51ff880c703ff4bdb13c
[lhc/web/wiklou.git] / languages / classes / LanguageVi.php
1 <?php
2 /**
3 * Based on Language.php 1.645
4 * @package MediaWiki
5 * @subpackage Language
6 * Compatible to MediaWiki 1.5
7 * Initial translation by Trần Thế Trung and Nguyễn Thanh Quang
8 * Last update 28 August 2005 (UTC)
9 */
10
11 class LanguageVi extends Language {
12 function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
13 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
14
15 $datePreference = $this->dateFormat( $format );
16
17 $month = $this->formatMonth( substr( $ts, 4, 2 ), $datePreference );
18 $day = $this->formatDay( substr( $ts, 6, 2 ), $datePreference );
19 $year = $this->formatNum( substr( $ts, 0, 4 ), true );
20
21 switch( $datePreference ) {
22 case 3:
23 case 4: return "$day/$month/$year";
24 case MW_DATE_ISO: return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
25 default: return "$day $month năm $year";
26 }
27 }
28
29 function timeSeparator( $format ) {
30 $datePreference = $this->dateFormat($format);
31 switch ( $datePreference ) {
32 case '4': return 'h';
33 default: return ':';
34 }
35 }
36
37 function timeDateSeparator( $format ) {
38 $datePreference = $this->dateFormat($format);
39 switch ( $datePreference ) {
40 case '0':
41 case '1':
42 case '2': return ', ';
43 default: return ' ';
44 }
45 }
46
47 function formatMonth( $month, $format ) {
48 $datePreference = $this->dateFormat($format);
49 switch ( $datePreference ) {
50 case '0':
51 case '1': return 'tháng ' . ( 0 + $month );
52 case '2': return 'tháng ' . $this->getSpecialMonthName( $month );
53 default: return 0 + $month;
54 }
55 }
56
57 function formatDay( $day, $format ) {
58 $datePreference = $this->dateFormat($format);
59 switch ( $datePreference ) {
60 case '0':
61 case '1':
62 case '2': return 'ngày ' . (0 + $day);
63 default: return 0 + $day;
64 }
65 }
66
67 function getSpecialMonthName( $key ) {
68 $names = 'Một, Hai, Ba, Tư, Năm, Sáu, Bảy, Tám, Chín, Mười, Mười một, Mười hai';
69 $names = explode(', ', $names);
70 return $names[$key-1];
71 }
72 }
73
74 ?>