LanguageNameIndexer/Search: use unicode aware lowercasing
With this MEÄNKELI with typos=1 finds results. Updated test case for lowercased result. Renamed variables in test file for clarity. Updated the default value for MW_INSTALL_PATH to work with the default layout. Change-Id: Id93c84d308705f55b4d2378fc8c7b7f243e1b53f
This commit is contained in:
@@ -37,7 +37,7 @@ class LanguageNameIndexer extends Maintenance {
|
||||
foreach ( $languages as $sourceLanguage => $autonym ) {
|
||||
$translations = LanguageNames::getNames( $sourceLanguage, 0, 2 );
|
||||
foreach ( $translations as $targetLanguage => $translation ) {
|
||||
$translation = strtolower( $translation );
|
||||
$translation = mb_strtolower( $translation );
|
||||
$bucket = LanguageNameSearch::getIndex( $translation );
|
||||
$buckets[$bucket][$translation] = $targetLanguage;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,11 @@ class LanguageNameSearch {
|
||||
self::init();
|
||||
}
|
||||
|
||||
// Use code's mb_strtolower compatibily code for MW < 1.27
|
||||
$language = Language::factory( 'en' );
|
||||
|
||||
// @todo: Shouldn't this be unicode aware?
|
||||
$searchKey = strtolower( $searchKey );
|
||||
$searchKey = $language->lc( $searchKey );
|
||||
$index = self::getIndex( $searchKey );
|
||||
|
||||
if ( !isset( self::$languagenames[$index] ) ) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user