Gave script groups clear names and sorted them. Documentation in comments. Add tests to check that no script has been left behind. Corrected Lath to Latn (thanks to testing). Rename langdb.js to ext.uls.data.js Add ResourceLoader module ext.uls.data Change-Id: I91fafa94ffd1eaf2d12c954fe3a71064276533f9
27 lines
501 B
JavaScript
27 lines
501 B
JavaScript
/*
|
|
* @author Amir E. Aharoni
|
|
* Utilities for querying the language db.
|
|
*/
|
|
(function ( $ ) {
|
|
"use strict";
|
|
|
|
// Constants
|
|
var scriptIndex = 0,
|
|
regionsIndex = 1;
|
|
|
|
/*
|
|
* Returns the script group of a script or 'Other' if it doesn't
|
|
* belong to any group.
|
|
*/
|
|
$.uls.data.groupOfScript = function( script ) {
|
|
for ( var group in $.uls.data.scriptgroups ) {
|
|
if ( $.inArray( script, $.uls.data.scriptgroups[group] ) != -1 ) {
|
|
return group;
|
|
}
|
|
}
|
|
|
|
return 'Other';
|
|
}
|
|
|
|
} )( jQuery );
|