Adding language presence by territory to langdb

A very simple mechanism for importing per-country language lists
from CLDR to ULS' langdb.

If I understand correctly, we only need languages spoken in a country
ordered by number of speakers. The CLDR data already has it and it should be
mostly useful.

Also added a utility function and a test.

Some tweaks to override the CLDR data are still needed:

* The data as it is omits some useful languages. For example, Amharic is not
  listed in Eritrea.
* Some countries have a very large number of languages. Ideally it's right,
  but is not practical currently, for example India with 75. Maybe
  hand-picking or limiting the choice to top X languages can be useful,
  but requires thought.
* Some language codes are standard, but different from Wikipedia practice,
  for example "pa_Guru" (we just write "pa"). Maybe a mapping of codes
  is needed.

Change-Id: I3c0cd5a9118997ba39a4f3695978e359f3de6956
This commit is contained in:
Amir E. Aharoni
2012-08-23 23:08:52 +03:00
parent 0d73ffe09e
commit ca411138c7
4 changed files with 62 additions and 5 deletions

View File

@@ -61,7 +61,7 @@ test( "-- Initial check", function() {
} );
test( "-- $.uls.data testing", function() {
expect( 23 );
expect( 24 );
strictEqual( $.uls.data.autonyms()['he'], 'עברית', 'Correct autonym is returned for Hebrew using autonyms().' );
@@ -128,6 +128,8 @@ test( "-- $.uls.data testing", function() {
strictEqual( $.uls.data.isRtl( "te" ), false, "Telugu language is not RTL" );
strictEqual( $.uls.data.isRtl( "dv" ), true, "Divehi language is RTL" );
ok( $.inArray( "sah", $.uls.data.languagesInTerritory( "RU" ) ) > -1, "Sakha language is spoken in Russia" );
} );
}() );