Add basic information and utils for RTL scripts
Change-Id: Ie01b58cd3627e8f0bf726f0bb296bffb25efcbb5
This commit is contained in:
@@ -554,6 +554,9 @@ scriptgroups:
|
|||||||
SignWriting: [Sgnw]
|
SignWriting: [Sgnw]
|
||||||
NativeAmerican: [Cher, Cans]
|
NativeAmerican: [Cher, Cans]
|
||||||
|
|
||||||
|
rtlscripts:
|
||||||
|
[Arab, Hebr, Syrc, Nkoo, Thaa]
|
||||||
|
|
||||||
regiongroups:
|
regiongroups:
|
||||||
# north-america
|
# north-america
|
||||||
NA: 1
|
NA: 1
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -329,4 +329,13 @@
|
|||||||
autonymB = $.uls.data.autonym( b ) || b;
|
autonymB = $.uls.data.autonym( b ) || b;
|
||||||
return ( autonymA.toLowerCase() < autonymB.toLowerCase() ) ? -1 : 1;
|
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 );
|
} )( jQuery );
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ test( "-- Initial check", function() {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
test( "-- $.uls.data testing", function() {
|
test( "-- $.uls.data testing", function() {
|
||||||
expect( 21 );
|
expect( 23 );
|
||||||
|
|
||||||
strictEqual( $.uls.data.autonyms()['he'], 'עברית', 'Correct autonym is returned for Hebrew using autonyms().' );
|
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
|
// 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' );
|
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" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
}() );
|
}() );
|
||||||
|
|||||||
Reference in New Issue
Block a user