Yaron Koren has submitted this change and it was merged.

Change subject: i18n overhaul: changed to JSON, qqq msgs added, fixed some 
hardcoded English
......................................................................


i18n overhaul: changed to JSON, qqq msgs added, fixed some hardcoded English

Change-Id: I42b27378c60d6686ca191a19b961a6101c81c0d3
---
M SiteSettings.i18n.php
M SiteSettings.php
M SpecialSiteSettings.php
A i18n/en.json
A i18n/qqq.json
5 files changed, 148 insertions(+), 64 deletions(-)

Approvals:
  Yaron Koren: Verified; Looks good to me, approved



diff --git a/SiteSettings.i18n.php b/SiteSettings.i18n.php
index dccc255..bab11f3 100644
--- a/SiteSettings.i18n.php
+++ b/SiteSettings.i18n.php
@@ -1,62 +1,20 @@
 <?php
-/**
- * @author Yaron Koren
- */
-
 $messages = array();
+$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, 
&$cachedData ) {
+       $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
+       foreach ( $codeSequence as $csCode ) {
+               $fileName = __DIR__ . "/i18n/$csCode.json";
+               if ( is_readable( $fileName ) ) {
+                       $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
+                       foreach ( array_keys( $data ) as $key ) {
+                               if ( $key === '' || $key[0] === '@' ) {
+                                       unset( $data[$key] );
+                               }
+                       }
+                       $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
+               }
 
-$messages['en'] = array(
-       'sitesettings-desc' => "Allows for modifying settings through a wiki 
interface",
-       'sitesettings' => 'Site settings',
-       'sitesettings-sitename' => 'Site name:',
-       'sitesettings-sitenamespace' => 'Site-specific namespace name:',
-       'sitesettings-timezone' => 'Hours offset from GMT:',
-       'sitesettings-current-gmt' => '(current GMT time is $1 or $2)',
-       'sitesettings-americandates' => 'Use American-style dates',
-       'sitesettings-showpageviews' => 'Show count of page views at the bottom 
of each page',
-       'sitesettings-usesubpages' => 'Use <a 
href="http://www.mediawiki.org/wiki/Help:Subpages";>subpages</a>',
-       'sitesettings-allowexternalimages' => 'Allow external images',
-       'sitesettings-allowlowercasepagenames' => 'Allow lowercase page names',
-       'sitesettings-copyrighturl' => 'Copyright URL:',
-       'sitesettings-copyrightdesc' => 'Copyright description:',
-       'sitesettings-viewingpolicy' => 'Viewing',
-       'sitesettings-public' => 'Public',
-       'sitesettings-publicdesc' => 'Everyone can read the site',
-       'sitesettings-private' => 'Private',
-       'sitesettings-privatedesc' => 'Only registered users can read the site',
-       'sitesettings-veryprivate' => 'Very private',
-       'sitesettings-veryprivatedesc' => 'Users can only view the main page 
and their own user page',
-       'sitesettings-registrationpolicy' => 'Registration',
-       'sitesettings-openreg' => 'Open',
-       'sitesettings-openregdesc' => 'Everyone can register',
-       'sitesettings-openidreg' => 'OpenID only',
-       'sitesettings-closedreg' => 'Closed',
-       'sitesettings-closedregdesc' => 'Users can only be added by an 
administrator',
-       'sitesettings-editingpolicy' => 'Editing',
-       'sitesettings-openediting' => 'Open',
-       'sitesettings-openeditingdesc' => 'Everyone can edit',
-       'sitesettings-closedediting' => 'Closed',
-       'sitesettings-closededitingdesc' => 'Only registered users can edit',
-       'sitesettings-veryclosedediting' => 'Very closed',
-       'sitesettings-veryclosededitingdesc' => 'Only administrators can edit',
-       'sitesettings-updated' => 'Site settings were updated.',
-       'sitesettings-appearanceupdated' => 'Site appearance settings were 
updated.',
-       'sitesettings-userskinsreset' => 'The skin for all existing users of 
this wiki has been changed to "$1".',
-       'sitesettings-sitelogo' => 'Logo',
-       'sitesettings-nologo' => 'There is no current logo.',
-       'sitesettings-uploadlogo' => 'Upload logo:',
-       'sitesettings-currentlogo' => 'Current logo:',
-       'sitesettings-removelogo' => 'Remove logo',
-       'sitesettings-changelogo' => 'Change logo:',
-       'sitesettings-logouploaded' => 'Logo was uploaded.',
-       'sitesettings-logoremoved' => 'Logo was removed.',
-       'sitesettings-faviconheader' => 'Favicon file',
-       'sitesettings-sitefavicon' => 'Favicon',
-       'sitesettings-nofavicon' => 'There is no current favicon.',
-       'sitesettings-uploadfavicon' => 'Upload favicon (it should be called 
"favicon.ico"):',
-       'sitesettings-currentfavicon' => 'Current favicon:',
-       'sitesettings-removefavicon' => 'Remove favicon',
-       'sitesettings-changefavicon' => 'Change favicon:',
-       'sitesettings-faviconuploaded' => 'Favicon was uploaded.',
-       'sitesettings-faviconremoved' => 'Favicon was removed.',
-);
+               $cachedData['deps'][] = new FileDependency( $fileName );
+       }
+       return true;
+};
diff --git a/SiteSettings.php b/SiteSettings.php
index c2e6534..1595e02 100644
--- a/SiteSettings.php
+++ b/SiteSettings.php
@@ -31,6 +31,7 @@
        'descriptionmsg' => 'sitesettings-desc',
 );
 
+$wgMessagesDirs['SiteSettings'] = $dir . '/i18n';
 $wgExtensionMessagesFiles['SiteSettings'] = $dir . '/SiteSettings.i18n.php';
 
 $wgExtensionFunctions[] = 'SSUtils::initializeSite';
diff --git a/SpecialSiteSettings.php b/SpecialSiteSettings.php
index e7f0358..ad7b472 100644
--- a/SpecialSiteSettings.php
+++ b/SpecialSiteSettings.php
@@ -133,11 +133,12 @@
 END;
 
                wfRunHooks( 'SiteSettingsMainTab', array( $siteSettings, &$text 
) );
+               $update_label = wfMessage( 'sitesettings-update' )->text();
                $text .=<<<END
-       <p><input type="Submit" name="update" value="Update" 
id="prefsubmit"></p>
+       <p><input type="Submit" name="update" value="$update_label" 
id="prefsubmit"></p>
 
 END;
-               return $this->printTab('Main', $text);
+               return $this->printTab( wfMessage( 'sitesettings-maintab' 
)->text(), $text );
        }
 
        function printPrivacyTab($siteSettings) {
@@ -169,11 +170,12 @@
 
                wfRunHooks( 'SiteSettingsPrivacyTab', array( $siteSettings, 
&$text ) );
 
+               $update_label = wfMessage( 'sitesettings-update' )->text();
                $text .=<<<END
-       <p><input type="Submit" name="update-privacy" value="Update" 
id="prefsubmit"></p>
+       <p><input type="Submit" name="update-privacy" value="$update_label" 
id="prefsubmit"></p>
 
 END;
-               return $this->printTab('Privacy', $text);
+               return $this->printTab( wfMessage( 'sitesettings-privacytab' 
)->text(), $text );
        }
 
        function printSkinTab($siteSettings) {
@@ -216,8 +218,9 @@
                $text .= "</p>\n";
                wfRunHooks( 'SiteSettingsSkinTab', array( $siteSettings, &$text 
) );
 
+               $update_label = wfMessage( 'sitesettings-update' )->text();
                $text .=<<<END
-       <p><input type="Submit" name="update-appearance" value="Update" 
id="prefsubmit"></p>
+       <p><input type="Submit" name="update-appearance" value="$update_label" 
id="prefsubmit"></p>
 END;
 
                $text .=<<<END
diff --git a/i18n/en.json b/i18n/en.json
new file mode 100644
index 0000000..69df455
--- /dev/null
+++ b/i18n/en.json
@@ -0,0 +1,61 @@
+{
+    "@metadata": {
+        "authors": [
+            "Yaron Koren"
+        ]
+    },
+    "sitesettings-desc": "Allows for modifying settings through a wiki 
interface",
+    "sitesettings": "Site settings",
+    "sitesettings-maintab": "Main",
+    "sitesettings-sitename": "Site name:",
+    "sitesettings-sitenamespace": "Site-specific namespace name:",
+    "sitesettings-timezone": "Hours offset from GMT:",
+    "sitesettings-current-gmt": "(current GMT time is $1 or $2)",
+    "sitesettings-americandates": "Use American-style dates",
+    "sitesettings-showpageviews": "Show count of page views at the bottom of 
each page",
+    "sitesettings-usesubpages": "Use <a 
href=\"http://www.mediawiki.org/wiki/Help:Subpages\";>subpages</a>",
+    "sitesettings-allowexternalimages": "Allow external images",
+    "sitesettings-allowlowercasepagenames": "Allow lowercase page names",
+    "sitesettings-copyrightdesc": "Copyright description:",
+    "sitesettings-copyrighturl": "Copyright URL:",
+    "sitesettings-update": "Update",
+    "sitesettings-privacytab": "Privacy",
+    "sitesettings-viewingpolicy": "Viewing",
+    "sitesettings-public": "Public",
+    "sitesettings-publicdesc": "Everyone can read the site",
+    "sitesettings-private": "Private",
+    "sitesettings-privatedesc": "Only registered users can read the site",
+    "sitesettings-veryprivate": "Very private",
+    "sitesettings-veryprivatedesc": "Users can only view the main page and 
their own user page",
+    "sitesettings-registrationpolicy": "Registration",
+    "sitesettings-openreg": "Open",
+    "sitesettings-openregdesc": "Everyone can register",
+    "sitesettings-closedreg": "Closed",
+    "sitesettings-closedregdesc": "Users can only be added by an 
administrator",
+    "sitesettings-editingpolicy": "Editing",
+    "sitesettings-openediting": "Open",
+    "sitesettings-openeditingdesc": "Everyone can edit",
+    "sitesettings-closedediting": "Closed",
+    "sitesettings-closededitingdesc": "Only registered users can edit",
+    "sitesettings-veryclosedediting": "Very closed",
+    "sitesettings-veryclosededitingdesc": "Only administrators can edit",
+    "sitesettings-updated": "Site settings were updated.",
+    "sitesettings-appearanceupdated": "Site appearance settings were updated.",
+    "sitesettings-userskinsreset": "The skin for all existing users of this 
wiki has been changed to \"$1\".",
+    "sitesettings-sitelogo": "Logo",
+    "sitesettings-nologo": "There is no current logo.",
+    "sitesettings-uploadlogo": "Upload logo:",
+    "sitesettings-currentlogo": "Current logo:",
+    "sitesettings-removelogo": "Remove logo",
+    "sitesettings-changelogo": "Change logo:",
+    "sitesettings-logouploaded": "Logo was uploaded.",
+    "sitesettings-logoremoved": "Logo was removed.",
+    "sitesettings-faviconheader": "Favicon file",
+    "sitesettings-nofavicon": "There is no current favicon.",
+    "sitesettings-uploadfavicon": "Upload favicon (it should be called 
\"favicon.ico\"):",
+    "sitesettings-currentfavicon": "Current favicon:",
+    "sitesettings-removefavicon": "Remove favicon",
+    "sitesettings-changefavicon": "Change favicon:",
+    "sitesettings-faviconuploaded": "Favicon was uploaded.",
+    "sitesettings-faviconremoved": "Favicon was removed."
+}
diff --git a/i18n/qqq.json b/i18n/qqq.json
new file mode 100644
index 0000000..5ee6155
--- /dev/null
+++ b/i18n/qqq.json
@@ -0,0 +1,61 @@
+{
+    "@metadata": {
+        "authors": [
+            "Yaron Koren"
+        ]
+    },
+    "sitesettings-desc": "{{desc|name=Site 
Settings|url=http://www.mediawiki.org/wiki/Extension:Site_Settings}}";
+    "sitesettings": "{{doc-special|SiteSettings}}",
+    "sitesettings-maintab": "The name of the main/first tab.",
+    "sitesettings-sitename": "The label for the input to set the wiki's name.",
+    "sitesettings-sitenamespace": "The label for the input to set the name of 
the wiki's 'Project' namespace.",
+    "sitesettings-timezone": "The label for the input to set the number of 
hours the wiki's time zone is away from Greenwich Mean Time.",
+    "sitesettings-current-gmt": "A statement of the current GMT time, to make 
it easier for users to know what their offset is from GMT; $1 and $2 show the 
time in two different formats.",
+    "sitesettings-americandates": "The label for a checkbox to show dates in 
'American-style' format, i.e. with the month first.",
+    "sitesettings-showpageviews": "The label for a checkbox.",
+    "sitesettings-usesubpages": "The label for a checkbox.",
+    "sitesettings-allowexternalimages": "The label for a checkbox to let users 
display external images in this wiki's pages.",
+    "sitesettings-allowlowercasepagenames": "The label for a checkbox to let 
users create wiki pages whose name starts with a lowercase letter.",
+    "sitesettings-copyrightdesc": "The label for an input.",
+    "sitesettings-copyrighturl": "The label for an input.",
+    "sitesettings-update": "The text on a button used to update the site 
setttings.",
+    "sitesettings-privacytab": "The name of the tab for settings related to 
control of viewing, registration and editing.",
+    "sitesettings-viewingpolicy": "A header for the section holding 
permissions related to viewing the wiki.",
+    "sitesettings-public": "A privacy setting in which everyone can read the 
wiki's contents.",
+    "sitesettings-publicdesc": "A longer explanation of 
{{msg-mw|sitesettings-private}}Everyone can read the site",
+    "sitesettings-private": "A privacy setting in which only registered users 
can read the wiki's contents.",
+    "sitesettings-privatedesc": "A longer explanation of 
{{msg-mw|sitesettings-private}}",
+    "sitesettings-veryprivate": "A privacy setting in which users can only 
view the main page and their own user page.",
+    "sitesettings-veryprivatedesc": "A longer explanation of 
{{msg-mw|sitesettings-veryprivate}}",
+    "sitesettings-registrationpolicy": "A header for the section holding 
permissions related to registering on the wiki.",
+    "sitesettings-openreg": "A privacy setting in which every user can 
register.",
+    "sitesettings-openregdesc": "A longer explanation of 
{{msg-mw|sitesettings-openreg}}",
+    "sitesettings-closedreg": "A privacy setting in which users can only be 
registered by administrators.",
+    "sitesettings-closedregdesc": "A longer explanation of 
{{msg-mw|sitesettings-closedreg}}",
+    "sitesettings-editingpolicy": "A header for the section holding 
permissions related to editing the wiki.",
+    "sitesettings-openediting": "A privacy setting in which any user can edit 
pages.",
+    "sitesettings-openeditingdesc": "A longer explanation of 
{{msg-mw|sitesettings-openediting}}",
+    "sitesettings-closedediting": "A privacy setting in which only registered 
users can edit pages.",
+    "sitesettings-closededitingdesc": "A longer explanation of 
{{msg-mw|sitesettings-closedediting}}",
+    "sitesettings-veryclosedediting": "A privacy setting in which only the 
wiki's administrators can edit pages.",
+    "sitesettings-veryclosededitingdesc": "A longer explanation of 
{{msg-mw|sitesettings-veryclosedediting}}",
+    "sitesettings-updated": "Message displayed to the user after they 
successfully save the site settings.",
+    "sitesettings-appearanceupdated": "Message displayed to the user after 
they successfully save the settings related to the site's appearance.",
+    "sitesettings-userskinsreset": "Message displayed to the user after they 
change the default skin for all the wiki's users.",
+    "sitesettings-sitelogo": "A section header for settings related to the 
wiki's logo.",
+    "sitesettings-nologo": "Message indicating that a logo for this wiki has 
not been uploaded.",
+    "sitesettings-uploadlogo": "The label for an input to let users upload a 
wiki's logo.",
+    "sitesettings-currentlogo": "The label for the name of the wiki's current 
logo.",
+    "sitesettings-removelogo": "The label for the button to remove the wiki's 
current logo.",
+    "sitesettings-changelogo": "The label for an input to let users upload a 
new image to be the wiki's logo.",
+    "sitesettings-logouploaded": "Status message after a logo for the wiki is 
uploaded.",
+    "sitesettings-logoremoved": "Status message after a wiki's logo is 
'removed' (the image is not deleted, but it is no longer the logo).",
+    "sitesettings-faviconheader": "Header for actions relating to the wiki's 
[https://en.wikipedia.org/wiki/Favicon favicon]",
+    "sitesettings-nofavicon": "Tells the user that a 
[https://en.wikipedia.org/wiki/Favicon favicon] image has not been set for this 
wiki.",
+    "sitesettings-uploadfavicon": "The label for the input to let users upload 
a [https://en.wikipedia.org/wiki/Favicon favicon] for this wiki.",
+    "sitesettings-currentfavicon": "Current favicon:",
+    "sitesettings-removefavicon": "The label for the button to remove the 
wiki's current [https://en.wikipedia.org/wiki/Favicon favicon].",
+    "sitesettings-changefavicon": "The label for an input to let users upload 
a new image to be the wiki's [https://en.wikipedia.org/wiki/Favicon favicon].",
+    "sitesettings-faviconuploaded": "Status message after a 
[https://en.wikipedia.org/wiki/Favicon favicon] for the wiki is uploaded.",
+    "sitesettings-faviconremoved": "Status message after a wiki's 
[https://en.wikipedia.org/wiki/Favicon favicon] is 'removed' (the image is not 
deleted, but it is no longer the favicon).",
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/133717
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I42b27378c60d6686ca191a19b961a6101c81c0d3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SiteSettings
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to