Got rid of about 20 regex calls in braceSubstitution() relating to function-like...
[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 MAG_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 function date( $ts, $adj = false, $format = true) {
107 if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.
108 $format = $this->dateFormat($format);
109
110 switch( $format ) {
111 # 15. jan. 2001 kl. 16:12 || 16:12, 15. jan. 2001
112 case '2': case '4': return (0 + substr( $ts, 6, 2 )) . '. ' .
113 $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . '. ' .
114 substr($ts, 0, 4);
115 # 2001-01-15 16:12:34
116 case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
117
118 # 15. janúar 2001 kl. 16:12 || 16:12, 15. janúar 2001
119 default: return (0 + substr( $ts, 6, 2 )) . '. ' .
120 $this->getMonthName( substr( $ts, 4, 2 ) ) . ' ' .
121 substr($ts, 0, 4);
122 }
123
124 }
125
126 function time($ts, $adj = false, $format = true) {
127 global $wgUser;
128 if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.
129
130 $format = $this->dateFormat($format);
131
132 switch( $format ) {
133 # 2001-01-15 16:12:34
134 case 'ISO 8601': return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ) . ':' . substr( $ts, 12, 2 );
135 default: return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
136 }
137
138 }
139
140 function timeanddate( $ts, $adj = false, $format = true) {
141 global $wgUser;
142
143 $format = $this->dateFormat($format);
144
145 switch ( $format ) {
146 # 16:12, 15. janúar 2001 || 16:12, 15. jan. 2001
147 case '3': case '4': return $this->time( $ts, $adj, $format ) . ', ' . $this->date( $ts, $adj, $format );
148 # 2001-01-15 16:12:34
149 case 'ISO 8601': return $this->date( $ts, $adj, $format ) . ' ' . $this->time( $ts, $adj, $format );
150 # 15. janúar 2001 kl. 16:12 || 15. jan. 2001 kl. 16:12
151 default: return $this->date( $ts, $adj, $format ) . ' kl. ' . $this->time( $ts, $adj, $format );
152
153 }
154
155 }
156
157 /**
158 * The Icelandic number style uses dots where English would use commas
159 * and commas where English would use dots, e.g. 201.511,17 not 201,511.17
160 */
161 function separatorTransformTable() {
162 return array(',' => '.', '.' => ',' );
163 }
164
165 function linkPrefixExtension() {
166 // return '/^(.*?)([áÁðÐéÉíÍóÓúÚýÝþÞæÆöÖA-Za-z-–]+)$/sDu';
167 return true;
168 }
169
170 function linkTrail() {
171 return '/^([áðéíóúýþæöa-z-–]+)(.*)$/sDu';
172 }
173
174 }
175
176 ?>