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