http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73404

Revision: 73404
Author:   kaldari
Date:     2010-09-20 20:17:10 +0000 (Mon, 20 Sep 2010)

Log Message:
-----------
making Banner Allocation localizable

Modified Paths:
--------------
    trunk/extensions/CentralNotice/CentralNotice.i18n.php
    trunk/extensions/CentralNotice/SpecialBannerAllocation.php

Modified: trunk/extensions/CentralNotice/CentralNotice.i18n.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.i18n.php       2010-09-20 
20:06:18 UTC (rev 73403)
+++ trunk/extensions/CentralNotice/CentralNotice.i18n.php       2010-09-20 
20:17:10 UTC (rev 73404)
@@ -124,6 +124,14 @@
        'centralnotice-geotargeted' => 'Geotargeted',
        'centralnotice-countries' => 'Countries',
        'centralnotice-allocation' => 'Allocation',
+       'centralnotice-view-allocation' => 'View banner allocation',
+       'centralnotice-allocation-instructions' => 'Choose the environment you 
would like to view banner allocation for:',
+       'centralnotice-project-language' => 'Project language',
+       'centralnotice-country' => 'Country',
+       'centralnotice-no-allocation' => 'No banners allocated.',
+       'centralnotice-allocation-description' => 'Banner allocation for $1.$2 
in $3:',
+       'centralnotice-percentage' => 'Percentage',
+       'centralnotice-percent' => '$1%',
        
        'right-centralnotice-admin' => 'Manage central notices',
        'right-centralnotice-translate' => 'Translate central notices',
@@ -146,8 +154,9 @@
  * @author The Evil IP address
  */
 $messages['qqq'] = array(
-       'centralnotice' => 'Name of Special:CentralNotice in 
Special:SpecialPages and title of the page',
-       'noticetemplate' => 'Title of Special:NoticeTemplate',
+       'centralnotice' => 'Name of Special:CentralNotice in 
Special:SpecialPages and title of Special:CentralNotice page',
+       'noticetemplate' => 'Title of Special:NoticeTemplate page, should be 
identical to centralnotice message. (Since the extension uses a secondary tab 
interface, the effective page title is actually 
centralnotice-manage-templates.)',
+       'bannerallocation' => 'Title of Special:BannerAllocation page, should 
be identical to centralnotice message.  (Since the extension uses a secondary 
tab interface, the effective page title is actually 
centralnotice-view-allocation.)',
        'centralnotice-desc' => '{{desc}}',
        'centralnotice-summary' => 'Used in Special:CentralNotice',
        'centralnotice-end-date' => '{{Identical|End date}}',
@@ -184,6 +193,9 @@
        'centralnotice-clone-name' => '{{Identical|Name}}',
        'centralnotice-insert' => '{{Identical|Insert}}',
        'centralnotice-geotargeted' => 'Used to label a checkbox which 
activates geotargeting',
+       'centralnotice-allocation-description' => 'A description of the 
environment whose allocation is being described. $1 is the language code for 
the site (en). $2 is the project name for the site (wikipedia). $3 is the 
country code (US).',
+       'centralnotice-percent' => 'A percentage as a number. $1 is the 
number.',
+       
        'right-centralnotice-admin' => '{{doc-right}}',
        'right-centralnotice-translate' => '{{doc-right}}',
        'action-centralnotice-admin' => '{{doc-action}}',

Modified: trunk/extensions/CentralNotice/SpecialBannerAllocation.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerAllocation.php  2010-09-20 
20:06:18 UTC (rev 73403)
+++ trunk/extensions/CentralNotice/SpecialBannerAllocation.php  2010-09-20 
20:17:10 UTC (rev 73404)
@@ -57,12 +57,12 @@
                $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 
'prefsection' ) );
                
                $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' 
) );
-               $htmlOut .= Xml::element( 'h2', null, 'View banner allocation' 
);
-               $htmlOut .= Xml::tags( 'p', null, 'Choose the environment you 
would like to view banner allocation for:' );
+               $htmlOut .= Xml::element( 'h2', null, wfMsg( 
'centralnotice-view-allocation' ) );
+               $htmlOut .= Xml::tags( 'p', null, wfMsg( 
'centralnotice-allocation-instructions' ) );
                
                $htmlOut .= Xml::openElement( 'table', array ( 'id' => 
'envpicker', 'cellpadding' => 7 ) );
                $htmlOut .= Xml::openElement( 'tr' );
-               $htmlOut .= Xml::tags( 'td', array( 'style' => 'width: 20%;' ), 
wfMsgHtml( 'centralnotice-project-name' ) );
+               $htmlOut .= Xml::tags( 'td', array( 'style' => 'width: 20%;' ), 
wfMsg( 'centralnotice-project-name' ) );
                $htmlOut .= Xml::openElement( 'td' );
                $htmlOut .= Xml::openElement( 'select', array( 'name' => 
'project' ) );
                foreach ( $wgNoticeProjects as $value ) {
@@ -72,7 +72,7 @@
                $htmlOut .= Xml::closeElement( 'td' );
                $htmlOut .= Xml::closeElement( 'tr' );
                $htmlOut .= Xml::openElement( 'tr' );
-               $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), 
'Project language' );
+               $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsg( 
'centralnotice-project-language' ) );
                $htmlOut .= Xml::openElement( 'td' );
                // Make sure the site language is in the list; a custom 
language code might not have a defined name...
                $languages = Language::getLanguageNames( true );
@@ -88,7 +88,7 @@
                $htmlOut .= Xml::closeElement( 'td' );
                $htmlOut .= Xml::closeElement( 'tr' );
                $htmlOut .= Xml::openElement( 'tr' );
-               $htmlOut .= Xml::tags( 'td', array(), 'Country' );
+               $htmlOut .= Xml::tags( 'td', array(), wfMsg( 
'centralnotice-country' ) );
                $htmlOut .= Xml::openElement( 'td' );
                $countries = CentralNoticeDB::getCountriesList();
                $htmlOut .= Xml::openElement( 'select', array( 'name' => 
'country' ) );
@@ -135,14 +135,22 @@
                // Begin Allocation list fieldset
                $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 
'prefsection' ) );
                
-               $htmlOut .= Xml::tags( 'p', null, 'Banner allocation for 
'.$wgRequest->getVal( 'language' ).'.'.$wgRequest->getVal( 'project' ).' in 
'.$wgRequest->getVal( 'country' ).':' );
-               
                $bannerLister = new SpecialBannerListLoader();
                $bannerLister->project = $wgRequest->getVal( 'project' );
                $bannerLister->language = $wgRequest->getVal( 'language' );
                $bannerLister->location = $wgRequest->getVal( 'country' );
+
+               $htmlOut .= Xml::tags( 'p', null,
+                       wfMsg (
+                               'centralnotice-allocation-description',
+                               htmlspecialchars( $bannerLister->language ),
+                               htmlspecialchars( $bannerLister->project ),
+                               htmlspecialchars( $bannerLister->country )
+                       )
+               );
+
                $bannerList = $bannerLister->getJsonList();
-               $banners = json_decode( $bannerList, true );
+               $banners = FormatJson::decode( $bannerList, true );
                $totalWeight = 0;
                foreach ( $banners as $banner ) {
                        $totalWeight += $banner['weight'];
@@ -150,13 +158,14 @@
                if ( $banners ) {
                        $htmlOut .= Xml::openElement( 'table', array ( 
'cellpadding' => 9, 'class' => 'wikitable sortable' ) );
                        $htmlOut .= Xml::openElement( 'tr' );
-                       $htmlOut .= Xml::element( 'th', array( 'width' => '40%' 
), 'Percentage' );
-                       $htmlOut .= Xml::element( 'th', array( 'width' => '60%' 
), wfMsg ( "centralnotice-banner" ) );
+                       $htmlOut .= Xml::element( 'th', array( 'width' => '40%' 
), wfMsg ( 'centralnotice-percentage' ) );
+                       $htmlOut .= Xml::element( 'th', array( 'width' => '60%' 
), wfMsg ( 'centralnotice-banner' ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        foreach ( $banners as $banner ) {
                                $htmlOut .= Xml::openElement( 'tr' );
                                $htmlOut .= Xml::openElement( 'td' );
-                               $htmlOut .= ( $banner['weight'] / $totalWeight 
) * 100 . "%";
+                               $percentage = ( $banner['weight'] / 
$totalWeight ) * 100;
+                               $htmlOut .= wfMsg ( 'centralnotice-percent', 
$percentage );
                                $htmlOut .= Xml::closeElement( 'td' );
                                $htmlOut .= Xml::tags( 'td', array( 'valign' => 
'top' ),
                                        $sk->makeLinkObj( $viewPage, 
htmlspecialchars( $banner['name'] ), 'template=' . urlencode( $banner['name'] ) 
)
@@ -165,7 +174,7 @@
                        }
                        $htmlOut .= Xml::closeElement( 'table' );
                } else {
-                       $htmlOut .= Xml::tags( 'p', null, 'No banners 
allocated.' );
+                       $htmlOut .= Xml::tags( 'p', null, wfMsg ( 
'centralnotice-no-allocation' ) );
                }
                
                // End Allocation list fieldset



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to