r7873 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7872‎ | r7873 | r7874 >
Date:21:45, 25 March 2005
Author:avar
Status:old
Tags:
Comment:
* Removed Wikipedia specific stuff ($wgDefaultUserOptionsIs and function
getDefaultUserOptions), now inherits options from the parent.

* Expanded on date(), time() and timeanddate() to support additional time
formats, i.e.:
'15. jan��ar 2001 kl. 16:12',
'15. jan. 2001 kl. 16:12',
'16:12, 15. jan��ar 2001',
'16:12, 15. jan. 2001',
'2001-01-15 16:12:34'
support still needs to be added for this one in other files in order for it
to return anything other than the default ( 15. jan��ar 2001 kl. 16:12 ).
Modified paths:
  • /trunk/phase3/languages/LanguageIs.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/LanguageIs.php
@@ -39,12 +39,6 @@
4040 NS_CATEGORY_TALK => 'Flokkaspjall'
4141 ) + $wgNamespaceNamesEn;
4242
43 -/* private */ $wgDefaultUserOptionsIs = array(
44 - 'date' => 2,
45 - # The Icelandic Wikipedia wishes to use PNG rendering by default.
46 - 'math' => 0,
47 -) + $wgDefaultUserOptionsEn;
48 -
4943 /* private */ $wgQuickbarSettingsIs = array(
5044 "Sleppa", "Fast vinstra megin", "Fast hægra megin", "Fljótandi til vinstri"
5145 );
@@ -62,11 +56,12 @@
6357 );
6458
6559 /* private */ $wgDateFormatsIs = array(
66 - "Alveg sama",
67 - "Janúar 15, 2001",
68 - "15 janúar 2001",
69 - "2001 janúar 15",
70 - "2001-01-15"
 60+ 'Sjálfgefið',
 61+ '15. janúar 2001 kl. 16:12',
 62+ '15. jan. 2001 kl. 16:12',
 63+ '16:12, 15. janúar 2001',
 64+ '16:12, 15. jan. 2001',
 65+ '2001-01-15 16:12:34'
7166 );
7267
7368 /* private */ $wgSysopSpecialPagesIs = array(
@@ -800,11 +795,6 @@
801796
802797 class LanguageIs extends LanguageUtf8 {
803798
804 - function getDefaultUserOptions () {
805 - global $wgDefaultUserOptionsIs;
806 - return $wgDefaultUserOptionsIs;
807 - }
808 -
809799 function getNamespaces() {
810800 global $wgNamespaceNamesIs;
811801 return $wgNamespaceNamesIs;
@@ -874,12 +864,49 @@
875865 }
876866
877867 function date( $ts, $adj = false ) {
 868+ global $wgUser;
878869 if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.
879 - $date = (0 + substr( $ts, 6, 2 )) . '. ' .
880 - $this->getMonthName( substr( $ts, 4, 2 ) ) . ' ' .
881 - substr($ts, 0, 4);
882 - return $date;
 870+
 871+ switch( $wgUser->getOption( 'date' ) ) {
 872+ # 15. jan. 2001 kl. 16:12 || 16:12, 15. jan. 2001
 873+ case 2: case 4: return (0 + substr( $ts, 6, 2 )) . '. ' .
 874+ $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . '. ' .
 875+ substr($ts, 0, 4);
 876+ # 2001-01-15 16:12:34
 877+ case 5: return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
 878+
 879+ # 15. janúar 2001 kl. 16:12 || 16:12, 15. janúar 2001
 880+ default: return (0 + substr( $ts, 6, 2 )) . '. ' .
 881+ $this->getMonthName( substr( $ts, 4, 2 ) ) . ' ' .
 882+ substr($ts, 0, 4);
 883+ }
 884+
883885 }
 886+
 887+ function time($ts, $adj = false) {
 888+ global $wgUser;
 889+ if ( $adj ) { $ts = $this->userAdjust( $ts ); } # Adjust based on the timezone setting.
 890+
 891+ switch( $wgUser->getOption( 'date' ) ) {
 892+ case 5: return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ) . ':' . substr( $ts, 12, 2 );
 893+ default: return substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
 894+ }
 895+
 896+ }
 897+
 898+ function timeanddate( $ts, $adj = false ) {
 899+ global $wgUser;
 900+
 901+ switch ( $wgUser->getOption( 'date' ) ) {
 902+ # 16:12, 15. janúar 2001 || 16:12, 15. jan. 2001
 903+ case 3: case 4: return $this->time( $ts, $adj ) . ', ' . $this->date( $ts, $adj );
 904+ # 2001-01-15 16:12:34
 905+ case 5: return $this->date( $ts, $adj ) . ' ' . $this->time( $ts, $adj );
 906+ default: return $this->date( $ts, $adj ) . ' kl. ' . $this->time( $ts, $adj );
 907+
 908+ }
 909+
 910+ }
884911 }
885912
886913 ?>

Status & tagging log