Add basic information and utils for RTL scripts

Change-Id: Ie01b58cd3627e8f0bf726f0bb296bffb25efcbb5
This commit is contained in:
Amir E. Aharoni
2012-08-22 18:16:01 +03:00
parent 567cb54a9a
commit 67dd765e13
4 changed files with 17 additions and 2 deletions

View File

@@ -554,6 +554,9 @@ scriptgroups:
SignWriting: [Sgnw]
NativeAmerican: [Cher, Cans]
rtlscripts:
[Arab, Hebr, Syrc, Nkoo, Thaa]
regiongroups:
# north-america
NA: 1

File diff suppressed because one or more lines are too long

View File

@@ -329,4 +329,13 @@
autonymB = $.uls.data.autonym( b ) || b;
return ( autonymA.toLowerCase() < autonymB.toLowerCase() ) ? -1 : 1;
};
/**
* Check if a language is right-to-left.
* @param string language code
* @return boolean
*/
$.uls.data.isRtl = function( language ) {
return $.inArray( $.uls.data.script( language ), $.uls.data.rtlscripts ) !== -1;
};
} )( jQuery );

View File

@@ -61,7 +61,7 @@ test( "-- Initial check", function() {
} );
test( "-- $.uls.data testing", function() {
expect( 21 );
expect( 23 );
strictEqual( $.uls.data.autonyms()['he'], 'עברית', 'Correct autonym is returned for Hebrew using autonyms().' );
@@ -125,6 +125,9 @@ test( "-- $.uls.data testing", function() {
// autonyms: gn: avañe'ẽ, de: deutsch, hu: magyar, fi: suomi
deepEqual( ['de', 'fi', 'gn', 'hu'].sort( $.uls.data.sortByAutonym ), ['gn', 'de', 'hu', 'fi'], 'Languages are correctly sorted by autonym' );
strictEqual( $.uls.data.isRtl( "te" ), false, "Telugu language is not RTL" );
strictEqual( $.uls.data.isRtl( "dv" ), true, "Divehi language is RTL" );
} );
}() );