summaryrefslogtreecommitdiff
path: root/languages/LanguageIs.php
blob: 97c5aa36f8d12ca2015cd12935c834902af05c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/** Icelandic (Íslenska)
 *
 * @package MediaWiki
 * @subpackage Language
 */

# Most of this was written by Ævar Arnfjörð Bjarmason <avarab@gmail.com>

require_once( 'LanguageUtf8.php' );

if (!$wgCachedMessageArrays) {
	require_once('MessagesIs.php');
}

class LanguageIs extends LanguageUtf8 {
	private $mMessagesIs, $mNamespaceNamesIs = null;

	private $mQuickbarSettingsIs = array(
		'Sleppa', 'Fast vinstra megin', 'Fast hægra megin', 'Fljótandi til vinstri'
	);
	
	private $mSkinNamesIs = array(
		'standard'	=> 'Klassískt',
		'nostalgia'	=> 'Gamaldags',
		'cologneblue'	=> 'Kölnarblátt',
		'myskin'	=> 'Mitt þema',
	);
	
	private $mDateFormatsIs = array(
		'Sjálfgefið',
		'15. janúar 2001 kl. 16:12',
		'15. jan. 2001 kl. 16:12',
		'16:12, 15. janúar 2001',
		'16:12, 15. jan. 2001',
		'ISO 8601' => '2001-01-15 16:12:34'
	);

	private $mMagicWordsIs = array(
		MAG_REDIRECT => array( 0, '#tilvísun', '#TILVÍSUN', '#redirect' ), // MagicWord::initRegex() sucks
	);

	function __construct() {
		parent::__construct();

		global $wgAllMessagesIs;
		$this->mMessagesIs =& $wgAllMessagesIs;

		global $wgMetaNamespace;
		$this->mNamespaceNamesIs = array(
			NS_MEDIA          => 'Miðill',
			NS_SPECIAL        => 'Kerfissíða',
			NS_MAIN           => '',
			NS_TALK           => 'Spjall',
			NS_USER           => 'Notandi',
			NS_USER_TALK      => 'Notandaspjall',
			NS_PROJECT        => $wgMetaNamespace,
			NS_PROJECT_TALK   => $wgMetaNamespace . 'spjall',
			NS_IMAGE          => 'Mynd',
			NS_IMAGE_TALK     => 'Myndaspjall',
			NS_MEDIAWIKI      => 'Melding',
			NS_MEDIAWIKI_TALK => 'Meldingarspjall',
			NS_TEMPLATE       => 'Snið',
			NS_TEMPLATE_TALK  => 'Sniðaspjall',
			NS_HELP           => 'Hjálp',
			NS_HELP_TALK      => 'Hjálparspjall',
			NS_CATEGORY       => 'Flokkur',
			NS_CATEGORY_TALK  => 'Flokkaspjall'
		);

	}

	function getNamespaces() {
		return $this->mNamespaceNamesIs + parent::getNamespaces();
	}

	function getQuickbarSettings() {
		return $this->mQuickbarSettingsIs;
	}

	function getSkinNames() {
		return $this->mSkinNamesIs + parent::getSkinNames();
	}

	function getDateFormats() {
		return $this->mDateFormatsIs;
	}

	function &getMagicWords()  {
		$t = $this->mMagicWordsIs + parent::getMagicWords();
		return $t;
	}

	function getMessage( $key ) {
		if( isset( $this->mMessagesIs[$key] ) ) {
			return $this->mMessagesIs[$key];
		} else {
			return parent::getMessage( $key );
		}
	}

	function getAllMessages() {
		return $this->mMessagesIs;
	}

	function date( $ts, $adj = false, $format = true) {
		if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.
		$format = $this->dateFormat($format);

		switch( $format ) {
			# 15. jan. 2001 kl. 16:12 || 16:12, 15. jan. 2001
			case '2': case '4': return (0 + substr( $ts, 6, 2 )) . '. ' .
				$this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . '. ' .
				substr($ts, 0, 4);
			# 2001-01-15 16:12:34
			case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);

			# 15. janúar 2001 kl. 16:12 || 16:12, 15. janúar 2001
			default: return (0 + substr( $ts, 6, 2 )) . '. ' .
				$this->getMonthName( substr( $ts, 4, 2 ) ) . ' ' .
				substr($ts, 0, 4);
		}

	}

	function time($ts, $adj = false, $format = true) {
		global $wgUser;
		if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.

		$format = $this->dateFormat($format);

		switch( $format ) {
			# 2001-01-15 16:12:34
			case 'ISO 8601': return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ) . ':' . substr( $ts, 12, 2 );
			default: return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
		}

	}

	function timeanddate( $ts, $adj = false, $format = true) {
		global $wgUser;

		$format = $this->dateFormat($format);

		switch ( $format ) {
			# 16:12, 15. janúar 2001 || 16:12, 15. jan. 2001
			case '3': case '4': return $this->time( $ts, $adj, $format ) . ', ' . $this->date( $ts, $adj, $format );
			# 2001-01-15 16:12:34
			case 'ISO 8601': return $this->date( $ts, $adj, $format ) . ' ' . $this->time( $ts, $adj, $format );
			# 15. janúar 2001 kl. 16:12 || 15. jan. 2001 kl. 16:12
			default: return $this->date( $ts, $adj, $format ) . ' kl. ' . $this->time( $ts, $adj, $format );

		}

	}

	/**
	 * The Icelandic number style uses dots where English would use commas
	 * and commas where English would use dots, e.g. 201.511,17 not 201,511.17
	 */
	function separatorTransformTable() {
		return array(',' => '.', '.' => ',' );
	}

	function linkPrefixExtension() {
		// return '/^(.*?)([áÁðÐéÉíÍóÓúÚýÝþÞæÆöÖA-Za-z-–]+)$/sDu';
		return true;
	}

	function linkTrail() {
		return '/^([áðéíóúýþæöa-z-–]+)(.*)$/sDu';
	}

}

?>