* (bug 11732) Allow localisation of edit button images
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Fri, 4 Jul 2008 10:34:41 +0000 (10:34 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Fri, 4 Jul 2008 10:34:41 +0000 (10:34 +0000)
RELEASE-NOTES
includes/EditPage.php
languages/Language.php
languages/messages/MessagesEn.php

index 4d0fe5b..836d501 100644 (file)
@@ -178,6 +178,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * MediawikiPerformAction hook is now passed the Mediawiki object
 * Added blank special page Special:BlankPage for benchmarking, etc.
 * Foreign repo file descriptions and thumbnails are now cached.
+* (bug 11732) Allow localisation of edit button images
  
 === Bug fixes in 1.13 ===
 
index e861b4b..98ab49f 100644 (file)
@@ -1799,7 +1799,7 @@ END
         * @return string
         */
        static function getEditToolbar() {
-               global $wgStylePath, $wgContLang, $wgJsMimeType;
+               global $wgStylePath, $wgContLang, $wgLang, $wgJsMimeType;
 
                /**
                 * toolarray an array of arrays which each include the filename of
@@ -1813,93 +1813,104 @@ END
                 * sure these keys are not defined on the edit page.
                 */
                $toolarray = array(
-                       array(  'image' => 'button_bold.png',
-                               'id'    => 'mw-editbutton-bold',
-                               'open'  => '\'\'\'',
-                               'close' => '\'\'\'',
-                               'sample'=> wfMsg('bold_sample'),
-                               'tip'   => wfMsg('bold_tip'),
-                               'key'   => 'B'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-bold'),
+                               'id'     => 'mw-editbutton-bold',
+                               'open'   => '\'\'\'',
+                               'close'  => '\'\'\'',
+                               'sample' => wfMsg('bold_sample'),
+                               'tip'    => wfMsg('bold_tip'),
+                               'key'    => 'B'
                        ),
-                       array(  'image' => 'button_italic.png',
-                               'id'    => 'mw-editbutton-italic',
-                               'open'  => '\'\'',
-                               'close' => '\'\'',
-                               'sample'=> wfMsg('italic_sample'),
-                               'tip'   => wfMsg('italic_tip'),
-                               'key'   => 'I'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-italic'),
+                               'id'     => 'mw-editbutton-italic',
+                               'open'   => '\'\'',
+                               'close'  => '\'\'',
+                               'sample' => wfMsg('italic_sample'),
+                               'tip'    => wfMsg('italic_tip'),
+                               'key'    => 'I'
                        ),
-                       array(  'image' => 'button_link.png',
-                               'id'    => 'mw-editbutton-link',
-                               'open'  => '[[',
-                               'close' => ']]',
-                               'sample'=> wfMsg('link_sample'),
-                               'tip'   => wfMsg('link_tip'),
-                               'key'   => 'L'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-link'),
+                               'id'     => 'mw-editbutton-link',
+                               'open'   => '[[',
+                               'close'  => ']]',
+                               'sample' => wfMsg('link_sample'),
+                               'tip'    => wfMsg('link_tip'),
+                               'key'    => 'L'
                        ),
-                       array(  'image' => 'button_extlink.png',
-                               'id'    => 'mw-editbutton-extlink',
-                               'open'  => '[',
-                               'close' => ']',
-                               'sample'=> wfMsg('extlink_sample'),
-                               'tip'   => wfMsg('extlink_tip'),
-                               'key'   => 'X'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-extlink'),
+                               'id'     => 'mw-editbutton-extlink',
+                               'open'   => '[',
+                               'close'  => ']',
+                               'sample' => wfMsg('extlink_sample'),
+                               'tip'    => wfMsg('extlink_tip'),
+                               'key'    => 'X'
                        ),
-                       array(  'image' => 'button_headline.png',
-                               'id'    => 'mw-editbutton-headline',
-                               'open'  => "\n== ",
-                               'close' => " ==\n",
-                               'sample'=> wfMsg('headline_sample'),
-                               'tip'   => wfMsg('headline_tip'),
-                               'key'   => 'H'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-headline'),
+                               'id'     => 'mw-editbutton-headline',
+                               'open'   => "\n== ",
+                               'close'  => " ==\n",
+                               'sample' => wfMsg('headline_sample'),
+                               'tip'    => wfMsg('headline_tip'),
+                               'key'    => 'H'
                        ),
-                       array(  'image' => 'button_image.png',
-                               'id'    => 'mw-editbutton-image',
-                               'open'  => '[['.$wgContLang->getNsText(NS_IMAGE).":",
-                               'close' => ']]',
-                               'sample'=> wfMsg('image_sample'),
-                               'tip'   => wfMsg('image_tip'),
-                               'key'   => 'D'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-image'),
+                               'id'     => 'mw-editbutton-image',
+                               'open'   => '[['.$wgContLang->getNsText(NS_IMAGE).':',
+                               'close'  => ']]',
+                               'sample' => wfMsg('image_sample'),
+                               'tip'    => wfMsg('image_tip'),
+                               'key'    => 'D'
                        ),
-                       array(  'image' => 'button_media.png',
-                               'id'    => 'mw-editbutton-media',
-                               'open'  => '[['.$wgContLang->getNsText(NS_MEDIA).':',
-                               'close' => ']]',
-                               'sample'=> wfMsg('media_sample'),
-                               'tip'   => wfMsg('media_tip'),
-                               'key'   => 'M'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-media'),
+                               'id'     => 'mw-editbutton-media',
+                               'open'   => '[['.$wgContLang->getNsText(NS_MEDIA).':',
+                               'close'  => ']]',
+                               'sample' => wfMsg('media_sample'),
+                               'tip'    => wfMsg('media_tip'),
+                               'key'    => 'M'
                        ),
-                       array(  'image' => 'button_math.png',
-                               'id'    => 'mw-editbutton-math',
-                               'open'  => "<math>",
-                               'close' => "</math>",
-                               'sample'=> wfMsg('math_sample'),
-                               'tip'   => wfMsg('math_tip'),
-                               'key'   => 'C'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-math'),
+                               'id'     => 'mw-editbutton-math',
+                               'open'   => "<math>",
+                               'close'  => "</math>",
+                               'sample' => wfMsg('math_sample'),
+                               'tip'    => wfMsg('math_tip'),
+                               'key'    => 'C'
                        ),
-                       array(  'image' => 'button_nowiki.png',
-                               'id'    => 'mw-editbutton-nowiki',
-                               'open'  => "<nowiki>",
-                               'close' => "</nowiki>",
-                               'sample'=> wfMsg('nowiki_sample'),
-                               'tip'   => wfMsg('nowiki_tip'),
-                               'key'   => 'N'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-nowiki'),
+                               'id'     => 'mw-editbutton-nowiki',
+                               'open'   => "<nowiki>",
+                               'close'  => "</nowiki>",
+                               'sample' => wfMsg('nowiki_sample'),
+                               'tip'    => wfMsg('nowiki_tip'),
+                               'key'    => 'N'
                        ),
-                       array(  'image' => 'button_sig.png',
-                               'id'    => 'mw-editbutton-signature',
-                               'open'  => '--~~~~',
-                               'close' => '',
-                               'sample'=> '',
-                               'tip'   => wfMsg('sig_tip'),
-                               'key'   => 'Y'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-sig'),
+                               'id'     => 'mw-editbutton-signature',
+                               'open'   => '--~~~~',
+                               'close'  => '',
+                               'sample' => '',
+                               'tip'    => wfMsg('sig_tip'),
+                               'key'    => 'Y'
                        ),
-                       array(  'image' => 'button_hr.png',
-                               'id'    => 'mw-editbutton-hr',
-                               'open'  => "\n----\n",
-                               'close' => '',
-                               'sample'=> '',
-                               'tip'   => wfMsg('hr_tip'),
-                               'key'   => 'R'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-hr'),
+                               'id'     => 'mw-editbutton-hr',
+                               'open'   => "\n----\n",
+                               'close'  => '',
+                               'sample' => '',
+                               'tip'    => wfMsg('hr_tip'),
+                               'key'    => 'R'
                        )
                );
                $toolbar = "<div id='toolbar'>\n";
index bfef4e5..624e43d 100644 (file)
@@ -57,15 +57,17 @@ class Language {
        var $mMagicExtensions = array(), $mMagicHookDone = false;
 
        static public $mLocalisationKeys = array( 'fallback', 'namespaceNames',
-               'skinNames', 'mathNames', 
-               'bookstoreList', 'magicWords', 'messages', 'rtl', 'digitTransformTable', 
+               'skinNames', 'mathNames',
+               'bookstoreList', 'magicWords', 'messages', 'rtl', 'digitTransformTable',
                'separatorTransformTable', 'fallback8bitEncoding', 'linkPrefixExtension',
-               'defaultUserOptionOverrides', 'linkTrail', 'namespaceAliases', 
-               'dateFormats', 'datePreferences', 'datePreferenceMigrationMap', 
-               'defaultDateFormat', 'extraUserToggles', 'specialPageAliases' );
+               'defaultUserOptionOverrides', 'linkTrail', 'namespaceAliases',
+               'dateFormats', 'datePreferences', 'datePreferenceMigrationMap',
+               'defaultDateFormat', 'extraUserToggles', 'specialPageAliases',
+               'imageFiles'
+       );
 
-       static public $mMergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames', 
-               'dateFormats', 'defaultUserOptionOverrides', 'magicWords' );
+       static public $mMergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames',
+               'dateFormats', 'defaultUserOptionOverrides', 'magicWords', 'imageFiles' );
 
        static public $mMergeableListKeys = array( 'extraUserToggles' );
 
@@ -339,6 +341,11 @@ class Language {
                return $this->datePreferenceMigrationMap;
        }
 
+       function getImageFile( $image ) {
+               $this->load();
+               return $this->imageFiles[$image];
+       }
+
        function getDefaultUserOptionOverrides() {
                $this->load();
                # XXX - apparently some languageas get empty arrays, didn't get to it yet -- midom
index 0530be4..51605dd 100644 (file)
@@ -442,6 +442,24 @@ $specialPageAliases = array(
  */
 $linkTrail = '/^(\p{L&}+)(.*)$/usD';
 
+/**
+ * List of filenames for some ui images that can be overridden per language
+ * basis if needed.
+*/
+$imageFiles = array(
+       'button-bold'     => 'button_bold.png',
+       'button-italic'   => 'button_italic.png',
+       'button-link'     => 'button_link.png',
+       'button-extlink'  => 'button_extlink.png',
+       'button-headline' => 'button_headline.png',
+       'button-image'    => 'button_image.png',
+       'button-media'    => 'button_media.png',
+       'button-math'     => 'button_math.png',
+       'button-nowiki'   => 'button_nowiki.png',
+       'button-sig'      => 'button_sig.png',
+       'button-hr'       => 'button_hr.png',
+);
+
 #-------------------------------------------------------------------
 # Default messages
 #-------------------------------------------------------------------