Commons upload license list language fix
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Fri, 30 Dec 2005 16:52:10 +0000 (16:52 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Fri, 30 Dec 2005 16:52:10 +0000 (16:52 +0000)
includes/Licenses.php

index 36b5a7e..5429b4c 100644 (file)
@@ -38,7 +38,20 @@ class Licenses {
         */
        function Licenses( $str = null ) {
                // PHP sucks, this should be possible in the constructor
-               $this->msg = is_null( $str ) ? wfMsgForContent( 'licenses' ) : $str;
+               
+               global $wgLanguageCode ;
+               if ( is_null( $str ) ) {
+                       # Try for language-localized license list; if not, try the deault
+                       $t = 'licenses/'.$wgLanguageCode ;
+                       $s = wfMsgForContent( $t ) ;
+                       if ( $s == '&lt;'.$t.'&gt;' )
+                               $t = wfMsgForContent( 'licenses' ) ;
+                       $this->msg = $s ;
+               } else {
+                       # Use passed string
+                       $this->msg = $str ;
+               }
+#              $this->msg = is_null( $str ) ? wfMsgForContent( 'licenses' ) : $str; # Old code, do not use!
                $this->html = '';
 
                $this->makeLicenses();