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.
* (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 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 ===
=== API changes in 1.13 ===
</div>
</form>', # don't translate or duplicate this message to other languages
</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
# Preferences page
'preferences' => 'Preferences',
'preferences-summary' => '', # only translate this message to other languages if you have to change it
require_once( dirname(__FILE__) . '/includes/WebStart.php' );
require_once( dirname(__FILE__) . '/languages/Names.php' );
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 );
$shortName = htmlspecialchars( mb_substr( $fullName, 0, 24 ) );
$siteName = htmlspecialchars( $fullName );
$response = $wgRequest->response();
$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
# 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