Fixes to avoid fragmentation in the language list

Adjustments in the language layout to make it easy to scan through
the language list and distinguish the different script groups:

* Removed the empty spacing row between groups.
* Changed the maximum number of languages in a column.
* Changed the order of script groups for better discoverability.

Change-Id: If223ae65bfec256c56d6092628b3999dfd02a119
This commit is contained in:
pginer
2012-08-13 21:54:24 +02:00
committed by Amir E. Aharoni
parent adf80d8791
commit a870263ad9
4 changed files with 29 additions and 23 deletions

View File

@@ -122,7 +122,7 @@ $wgResourceModules['jquery.uls.data'] = array(
); );
$wgResourceModules['jquery.webfonts'] = array( $wgResourceModules['jquery.webfonts'] = array(
'scripts' => 'lib/jquery.webfonts.js', 'scripts' => 'lib/jquery.webfonts.js',
'localBasePath' => $dir, 'localBasePath' => $dir,
'remoteExtPath' => 'UniversalLanguageSelector', 'remoteExtPath' => 'UniversalLanguageSelector',
); );

View File

@@ -496,18 +496,18 @@ languages:
# #
# The classification is roughly based on http://www.unicode.org/charts/ # The classification is roughly based on http://www.unicode.org/charts/
# with some practical corrections. # with some practical corrections.
# The order of the groups affects display. It was suggested by Pau to distance
# the largest groups from one another to improve discoverability.
scriptgroups: scriptgroups:
# Other is reserved # The group name "Other" is reserved.
# Large groups, one script in each # It's hard to find a better place for Goth except the Latin group.
Cyrillic: [Cyrl] Latin: [Latn, Goth]
Arabic: [Arab] # Greek is probalby different enough from Latin and Cyrillic, but user testing
# It's probalby different enough from Latin and Cyrillic, but user testing
# may prove otherwise. # may prove otherwise.
Greek: [Grek] Greek: [Grek]
# Couldn't find a better place for Goth.
Latin: [Latn, Goth]
WestCaucasian: [Armn, Geor] WestCaucasian: [Armn, Geor]
# Maybe it can be unified with Arabic. Arabic: [Arab]
# Maybe MiddleEastern can be unified with Arabic.
# Maybe Thaana can be moved here from SouthAsian. # Maybe Thaana can be moved here from SouthAsian.
# Maybe it can be unified with African. # Maybe it can be unified with African.
MiddleEastern: [Hebr, Syrc] MiddleEastern: [Hebr, Syrc]
@@ -522,10 +522,11 @@ scriptgroups:
# Unicode, because linguistically and geographically it's closely related to # Unicode, because linguistically and geographically it's closely related to
# the Brahmic family. # the Brahmic family.
SouthAsian: [Beng, Deva, Gujr, Guru, Knda, Mlym, Orya, Saur, Sinh, Taml, Telu, Tibt, Thaa] SouthAsian: [Beng, Deva, Gujr, Guru, Knda, Mlym, Orya, Saur, Sinh, Taml, Telu, Tibt, Thaa]
Cyrillic: [Cyrl]
CJK: [Hans, Hant, Kana, Kore, Jpan, Yiii]
SouthEastAsian: [Batk, Bugi, Java, Khmr, Laoo, Mymr, Thai] SouthEastAsian: [Batk, Bugi, Java, Khmr, Laoo, Mymr, Thai]
Mongolian: [Mong] Mongolian: [Mong]
SignWriting: [Sgnw] SignWriting: [Sgnw]
CJK: [Hans, Hant, Kana, Kore, Jpan, Yiii]
NativeAmerican: [Cher, Cans] NativeAmerican: [Cher, Cans]
regiongroups: regiongroups:

File diff suppressed because one or more lines are too long

View File

@@ -45,10 +45,9 @@
addToRegion: function( langCode, region ) { addToRegion: function( langCode, region ) {
var that = this; var that = this;
var language = that.options.languages[langCode], var language = that.options.languages[langCode],
langName = $.uls.data.autonym( langCode ) langName = $.uls.data.autonym( langCode ) || language || langCode,
|| language
|| langCode,
regions = []; regions = [];
if ( region ) { if ( region ) {
regions.push( region ); regions.push( region );
} else { } else {
@@ -67,19 +66,19 @@
// Append the element to the column in the list // Append the element to the column in the list
var $column = that.getColumn( regionCode ); var $column = that.getColumn( regionCode );
var lastLanguage = $column.find( 'li:last' ).data( 'code' ); var lastLanguage = $column.find( 'li:last' ).data( 'code' );
if ( lastLanguage ) { if ( lastLanguage ) {
var lastScriptGroup = $.uls.data.scriptGroupOfLanguage( lastLanguage ), var lastScriptGroup = $.uls.data.scriptGroupOfLanguage( lastLanguage ),
currentScriptGroup = $.uls.data.scriptGroupOfLanguage( langCode ); currentScriptGroup = $.uls.data.scriptGroupOfLanguage( langCode );
if ( lastScriptGroup !== currentScriptGroup ) { if ( lastScriptGroup !== currentScriptGroup ) {
if ( $column.find( 'li' ).length > 5 ) { if ( $column.find( 'li' ).length > 2 ) {
// If column has already 5 or more languages, add a new column // If column already has 2 or more languages, add a new column
$column = that.getColumn( regionCode, true ); $column = that.getColumn( regionCode, true );
} else {
// An empty item as column break.
$column.append( $( '<li>' ).addClass( 'uls-column-break' ) );
} }
} }
} }
$column.append( $li ); $column.append( $li );
if ( that.options.clickhandler ) { if ( that.options.clickhandler ) {
@@ -96,23 +95,29 @@
*/ */
getColumn: function( regionCode, forceNew ) { getColumn: function( regionCode, forceNew ) {
var $divRegionCode, $rowDiv, $ul; var $divRegionCode, $rowDiv, $ul;
forceNew = forceNew || false; forceNew = forceNew || false;
$divRegionCode = $( 'div#' + regionCode ); $divRegionCode = $( 'div#' + regionCode );
$rowDiv = $divRegionCode.find( 'div.row:last' ); $rowDiv = $divRegionCode.find( 'div.row:last' );
$ul = $divRegionCode.find( 'ul:last' ); $ul = $divRegionCode.find( 'ul:last' );
// Each column can have maximum 10 languages.
if ( $ul.length === 0 || $ul.find( 'li' ).length >= 10 || forceNew ) { // Each column can have maximum 8 languages.
if ( $ul.length === 0 || $ul.find( 'li' ).length >= 8 || forceNew ) {
$ul = $( '<ul>' ).addClass( 'three columns end' ); $ul = $( '<ul>' ).addClass( 'three columns end' );
if ( $rowDiv.length === 0 || $rowDiv.find( 'ul' ).length >= 4 ) { if ( $rowDiv.length === 0 || $rowDiv.find( 'ul' ).length >= 4 ) {
$rowDiv = $( '<div>' ).addClass( 'row uls-language-block' ); $rowDiv = $( '<div>' ).addClass( 'row uls-language-block' );
$divRegionCode.append( $rowDiv ); $divRegionCode.append( $rowDiv );
$ul.addClass( 'offset-by-one' ); $ul.addClass( 'offset-by-one' );
} }
$rowDiv.append( $ul ); $rowDiv.append( $ul );
} }
if( !$divRegionCode.is( ':visible' ) ) { if( !$divRegionCode.is( ':visible' ) ) {
$divRegionCode.show(); $divRegionCode.show();
} }
return $ul; return $ul;
}, },