* (bug 12723) OpenSearch description name now uses more compact language code
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 27 Feb 2008 04:53:24 +0000 (04:53 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 27 Feb 2008 04:53:24 +0000 (04:53 +0000)
  to avoid passing the length limit as often, is customizable per site via
  'opensearch-shortname' message.

Note that the spec actually says ShortName should be trimmed to *16* chars,
which is pretty awful -- 'Wikimedia Commons' doesn't even fit. I haven't
changed the current trimming (to 24 characters).

Note that Firefox uses the longer 'Description' field for its 'add' menu
item, but the ShortName for the actual item once you add it to the menu.

Possibly should have separate description and shortname thingies and do some
smarter trimming. Sigh.

RELEASE-NOTES
languages/messages/MessagesEn.php
opensearch_desc.php

index d7f6c99..68a550b 100644 (file)
@@ -48,6 +48,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 12988) $wgMinimalPasswordLength no longer breaks create user by email
 * (bug 13022) Fix upload from URL on PHP 5.0.x
 * (bug 13132) Unable to unprotect pages protected with earlier versions of MediaWiki
+* (bug 12723) OpenSearch description name now uses more compact language code
+  to avoid passing the length limit as often, is customizable per site via
+  'opensearch-shortname' message.
+
 
 === API changes in 1.13 ===
 
index f04f633..b71d38b 100644 (file)
@@ -1239,6 +1239,9 @@ Make sure that this change will maintain historical page continuity.
   </div>
 </form>', # don't translate or duplicate this message to other languages
 
+# OpenSearch description
+'opensearch-shortname'     => '{{SITENAME}} ({{CONTENTLANGUAGE}})',
+
 # Preferences page
 'preferences'              => 'Preferences',
 'preferences-summary'      => '', # only translate this message to other languages if you have to change it
index d766f19..187a74b 100644 (file)
@@ -6,7 +6,8 @@
 
 require_once( dirname(__FILE__) . '/includes/WebStart.php' );
 require_once( dirname(__FILE__) . '/languages/Names.php' );
-$fullName = "$wgSitename ({$wgLanguageNames[$wgLanguageCode]})";
+$fullName = "$wgSitename ($wgLanguageCode)";
+$fullName = wfMsg( 'opensearch-shortname' );
 $shortName = htmlspecialchars( mb_substr( $fullName, 0, 24 ) );
 $siteName = htmlspecialchars( $fullName );
 
@@ -20,7 +21,13 @@ $suggest = htmlspecialchars($wgServer . $wgScriptPath . '/api.php?action=opensea
 
 
 $response = $wgRequest->response();
-$response->header( 'Content-type: application/opensearchdescription+xml' );
+if( $wgRequest->getVal( 'ctype' ) == 'application/xml' ) {
+       // Makes testing tweaks about a billion times easier
+       $ctype = 'application/xml';
+} else {
+       $ctype = 'application/opensearchdescription+xml';
+}
+$response->header( "Content-type: $ctype" );
 
 # Set an Expires header so that squid can cache it for a short time
 # Short enough so that the sysadmin barely notices when $wgSitename is changed