Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/141125
Change subject: Add a 'namemsg' parameter to $wgExtensionCredits for
localizable names
......................................................................
Add a 'namemsg' parameter to $wgExtensionCredits for localizable names
Works similarly to 'description' and 'descriptionmsg', but 'name'
is still required because of weird shenanigans Special:Version does.
(And would be a good idea anyway for backwards-compatibility with
older MediaWikis.)
The primary use-case is skins (which have already traditionally had
translateable names in MediaWiki, but weren't always shown on
Special:Version), but there's no reason why regular extensions can't
use this too.
Skins which already have a translated name for Special:Preferences
('skinname-<skin>' messages) can reuse the same message here.
Change-Id: Iae6f770a8fe1968670429c22aefc1ae55e8dba6f
---
M RELEASE-NOTES-1.24
M includes/DefaultSettings.php
M includes/api/ApiQuerySiteinfo.php
M includes/specials/SpecialVersion.php
4 files changed, 29 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/25/141125/1
diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24
index 6c381bb..f891c8e 100644
--- a/RELEASE-NOTES-1.24
+++ b/RELEASE-NOTES-1.24
@@ -82,6 +82,10 @@
* Skins can now use 'remoteSkinPath' when defining ResourceLoader modules.
This works the same as 'remoteExtPath' but is relative to the skins/ folder
instead of the extensions/ folder.
+* Extensions and skins may now use 'namemsg' in $wgExtensionCredits in addition
+ to 'name', to allow for the name to be localizable. 'name' should still be
+ specified for backwards-compatibility and to define the path Special:Version
+ uses to find extension license information.
=== Bug fixes in 1.24 ===
* (bug 49116) Footer copyright notice is now always displayed in user language
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index bc7959b..5d09869 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -6083,6 +6083,7 @@
* $wgExtensionCredits[$type][] = array(
* 'path' => __FILE__,
* 'name' => 'Example extension',
+ * 'namemsg' => 'exampleextension-name',
* 'author' => array(
* 'Foo Barstein',
* ),
@@ -6102,15 +6103,24 @@
* 'skin', 'api', or 'other', or any additional types as specified through
the
* ExtensionTypes hook as used in SpecialVersion::getExtensionTypes().
*
+ * - name: Name of extension as an inline string instead of localizable
message.
+ * Do not omit this even if 'namemsg' is provided, as it is used to override
+ * the path Special:Version uses to find extension's license info, and is
+ * required for backwards-compatibility with MediaWiki 1.23 and older.
+ *
+ * - namemsg (since MW 1.24): A message key for a message containing the
+ * extension's name, if the name is localizable. (For example, skin names
+ * usually are.)
+ *
* - author: A string or an array of strings. Authors can be linked using
* the regular wikitext link syntax. To have an internationalized version of
* "and others" show, add an element "...". This element can also be linked,
* for instance "[http://example ...]".
*
* - descriptionmsg: A message key or an an array with message key and
parameters:
- * `'descriptionmsg' => array( 'exampleextension-desc', param1, param2, ...
),`
+ * `'descriptionmsg' => 'exampleextension-desc',`
*
- * - description: Description of extension as inline string instead of
+ * - description: Description of extension as an inline string instead of
* localizable message (omit in favour of 'descriptionmsg').
*
* - license-name: Short name of the license (used as label for the link), such
diff --git a/includes/api/ApiQuerySiteinfo.php
b/includes/api/ApiQuerySiteinfo.php
index 48a4ef4..a420b37 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -552,6 +552,9 @@
if ( isset( $ext['name'] ) ) {
$ret['name'] = $ext['name'];
}
+ if ( isset( $ext['namemsg'] ) ) {
+ $ret['namemsg'] = $ext['namemsg'];
+ }
if ( isset( $ext['description'] ) ) {
$ret['description'] =
$ext['description'];
}
diff --git a/includes/specials/SpecialVersion.php
b/includes/specials/SpecialVersion.php
index 657999c..b0523a7 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -587,7 +587,16 @@
// We must obtain the information for all the bits and pieces!
// ... such as extension names and links
- $extensionName = isset( $extension['name'] ) ?
$extension['name'] : '[no name]';
+ if ( isset( $extension['namemsg'] ) ) {
+ // Localized name of extension
+ $extensionName = $this->msg( $extension['namemsg']
)->text();
+ } elseif ( isset( $extension['name'] ) ) {
+ // Non localized version
+ $extensionName = $extension['name'];
+ } else {
+ $extensionName = '[no name]';
+ }
+
if ( isset( $extension['url'] ) ) {
$extensionNameLink = Linker::makeExternalLink(
$extension['url'],
--
To view, visit https://gerrit.wikimedia.org/r/141125
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae6f770a8fe1968670429c22aefc1ae55e8dba6f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits