profiling
[lhc/web/wiklou.git] / languages / LanguageIs.php
1 <?php
2 /** Icelandic (Íslenska)
3 *
4 * @package MediaWiki
5 * @subpackage Language
6 */
7
8 # Most of this was written by Ævar Arnfjörð Bjarmason <avarab@gmail.com>
9
10 require_once( 'LanguageUtf8.php' );
11
12 if (!$wgCachedMessageArrays) {
13 require_once('MessagesIs.php');
14 }
15
16 class LanguageIs extends LanguageUtf8 {
17 private $mMessagesIs, $mNamespaceNamesIs = null;
18
19 private $mQuickbarSettingsIs = array(
20 'Sleppa', 'Fast vinstra megin', 'Fast hægra megin', 'Fljótandi til vinstri'
21 );
22
23 private $mSkinNamesIs = array(
24 'standard' => 'Klassískt',
25 'nostalgia' => 'Gamaldags',
26 'cologneblue' => 'Kölnarblátt',
27 'myskin' => 'Mitt þema',
28 );
29
30 private $mDateFormatsIs = array(
31 'Sjálfgefið',
32 '15. janúar 2001 kl. 16:12',
33 '15. jan. 2001 kl. 16:12',
34 '16:12, 15. janúar 2001',
35 '16:12, 15. jan. 2001',
36 'ISO 8601' => '2001-01-15 16:12:34'
37 );
38
39 private $mMagicWordsIs = array(
40 'redirect' => array( 0, '#tilvísun', '#TILVÍSUN', '#redirect' ), // MagicWord::initRegex() sucks
41 );
42
43 function __construct() {
44 parent::__construct();
45
46 global $wgAllMessagesIs;
47 $this->mMessagesIs =& $wgAllMessagesIs;
48
49 global $wgMetaNamespace;
50 $this->mNamespaceNamesIs = array(
51 NS_MEDIA => 'Miðill',
52 NS_SPECIAL => 'Kerfissíða',
53 NS_MAIN => '',
54 NS_TALK => 'Spjall',
55 NS_USER => 'Notandi',
56 NS_USER_TALK => 'Notandaspjall',
57 NS_PROJECT => $wgMetaNamespace,
58 NS_PROJECT_TALK => $wgMetaNamespace . 'spjall',
59 NS_IMAGE => 'Mynd',
60 NS_IMAGE_TALK => 'Myndaspjall',
61 NS_MEDIAWIKI => 'Melding',
62 NS_MEDIAWIKI_TALK => 'Meldingarspjall',
63 NS_TEMPLATE => 'Snið',
64 NS_TEMPLATE_TALK => 'Sniðaspjall',
65 NS_HELP => 'Hjálp',
66 NS_HELP_TALK => 'Hjálparspjall',
67 NS_CATEGORY => 'Flokkur',
68 NS_CATEGORY_TALK => 'Flokkaspjall'
69 );
70
71 }
72
73 function getNamespaces() {
74 return $this->mNamespaceNamesIs + parent::getNamespaces();
75 }
76
77 function getQuickbarSettings() {
78 return $this->mQuickbarSettingsIs;
79 }
80
81 function getSkinNames() {
82 return $this->mSkinNamesIs + parent::getSkinNames();
83 }
84
85 function getDateFormats() {
86 return $this->mDateFormatsIs;
87 }
88
89 function &getMagicWords() {
90 $t = $this->mMagicWordsIs + parent::getMagicWords();
91 return $t;
92 }
93
94 function getMessage( $key ) {
95 if( isset( $this->mMessagesIs[$key] ) ) {
96 return $this->mMessagesIs[$key];
97 } else {
98 return parent::getMessage( $key );
99 }
100 }
101
102 function getAllMessages() {
103 return $this->mMessagesIs;
104 }
105
106 /**
107 * $timecorrection is for compatibility with Language::date
108 */
109 function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
110 if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.
111 $format = $this->dateFormat($format);
112
113 switch( $format ) {
114 # 15. jan. 2001 kl. 16:12 || 16:12, 15. jan. 2001
115 case '2': case '4': return (0 + substr( $ts, 6, 2 )) . '. ' .
116 $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . '. ' .
117 substr($ts, 0, 4);
118 # 2001-01-15 16:12:34
119 case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
120
121 # 15. janúar 2001 kl. 16:12 || 16:12, 15. janúar 2001
122 default: return (0 + substr( $ts, 6, 2 )) . '. ' .
123 $this->getMonthName( substr( $ts, 4, 2 ) ) . ' ' .
124 substr($ts, 0, 4);
125 }
126
127 }
128
129 /**
130 * $timecorrection is for compatibility with language::time
131 */
132 function time($ts, $adj = false, $format = true, $timecorrection = false) {
133 global $wgUser;
134 if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.
135
136 $format = $this->dateFormat($format);
137
138 switch( $format ) {
139 # 2001-01-15 16:12:34
140 case 'ISO 8601': return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ) . ':' . substr( $ts, 12, 2 );
141 default: return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
142 }
143
144 }
145
146 /**
147 * $timecorrection is for compatibility with Language::date
148 */
149 function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false ) {
150 global $wgUser;
151
152 $format = $this->dateFormat($format);
153
154 switch ( $format ) {
155 # 16:12, 15. janúar 2001 || 16:12, 15. jan. 2001
156 case '3': case '4': return $this->time( $ts, $adj, $format ) . ', ' . $this->date( $ts, $adj, $format );
157 # 2001-01-15 16:12:34
158 case 'ISO 8601': return $this->date( $ts, $adj, $format ) . ' ' . $this->time( $ts, $adj, $format );
159 # 15. janúar 2001 kl. 16:12 || 15. jan. 2001 kl. 16:12
160 default: return $this->date( $ts, $adj, $format ) . ' kl. ' . $this->time( $ts, $adj, $format );
161
162 }
163
164 }
165
166 /**
167 * The Icelandic number style uses dots where English would use commas
168 * and commas where English would use dots, e.g. 201.511,17 not 201,511.17
169 */
170 function separatorTransformTable() {
171 return array(',' => '.', '.' => ',' );
172 }
173
174 function linkPrefixExtension() {
175 // return '/^(.*?)([áÁðÐéÉíÍóÓúÚýÝþÞæÆöÖA-Za-z-–]+)$/sDu';
176 return true;
177 }
178
179 function linkTrail() {
180 return '/^([áðéíóúýþæöa-z-–]+)(.*)$/sDu';
181 }
182
183 }
184
185 ?>