Internationalize ULS

* Integrate jquery.i18n
* Update jquery.uls from upstream and use the build version

Change-Id: I523444b1f6b177f14a4799a455a16a14649b0e1b
This commit is contained in:
Santhosh Thottingal
2012-09-22 10:12:35 -07:00
parent e1a4f7f0cb
commit a13f9b739d
34 changed files with 4432 additions and 3771 deletions

View File

@@ -1 +0,0 @@
/node_modules

View File

@@ -1,19 +0,0 @@
jQuery Universal Language Selector
==================================
Universal Language Selector
Introduction
-------------
Preparing language data
------------------------
The language names, autonyms, region informations are present in src/jquery.uls.data.js.
But this file is auto generated from data/langdb.yaml. If you want to make any changes to the
language data, edit data/langdb.yaml and generate the src/jquery.uls.data.js using
```bash
php ulsdata2json.php
```

View File

@@ -214,3 +214,395 @@ span#languagefilter-clear {
#search-input-block {
position: relative;
}
/* Generated using Foundation http://foundation.zurb.com/docs/grid.php */
/* Global Reset & Standards ---------------------- */
.uls-menu * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* Misc ---------------------- */
.left {
float: left;
}
.right {
float: right;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.hide {
display: none;
}
.highlight {
background: #ffff99;
}
/* The Grid ---------------------- */
.row {
width: 100%;
max-width: none;
min-width: 600px;
margin: 0 auto;
}
.row .row {
width: auto;
max-width: none;
min-width: 0;
margin: 0 -5px;
}
.row.collapse .column, .row.collapse .columns {
padding: 0;
}
.row .row {
width: auto;
max-width: none;
min-width: 0;
margin: 0 -5px;
}
.row .row.collapse {
margin: 0;
}
.column, .columns {
float: left;
min-height: 1px;
padding: 0 5px;
position: relative;
}
.column.centered, .columns.centered {
float: none;
margin: 0 auto;
}
.row .one {
width: 8.333%;
}
.row .two {
width: 16.667%;
}
.row .three {
width: 25%;
}
.row .four {
width: 33.333%;
}
.row .five {
width: 41.667%;
}
.row .six {
width: 50%;
}
.row .seven {
width: 58.333%;
}
.row .eight {
width: 66.667%;
}
.row .nine {
width: 75%;
}
.row .ten {
width: 83.333%;
}
.row .eleven {
width: 91.667%;
}
.row .twelve {
width: 100%;
}
.row .offset-by-one {
margin-left: 8.333%;
}
.row .offset-by-two {
margin-left: 16.667%;
}
.row .offset-by-three {
margin-left: 25%;
}
.row .offset-by-four {
margin-left: 33.333%;
}
.row .offset-by-five {
margin-left: 41.667%;
}
.row .offset-by-six {
margin-left: 50%;
}
.row .offset-by-seven {
margin-left: 58.333%;
}
.row .offset-by-eight {
margin-left: 66.667%;
}
.row .offset-by-nine {
margin-left: 75%;
}
.row .offset-by-ten {
margin-left: 83.333%;
}
.push-two {
left: 16.667%;
}
.pull-two {
right: 16.667%;
}
.push-three {
left: 25%;
}
.pull-three {
right: 25%;
}
.push-four {
left: 33.333%;
}
.pull-four {
right: 33.333%;
}
.push-five {
left: 41.667%;
}
.pull-five {
right: 41.667%;
}
.push-six {
left: 50%;
}
.pull-six {
right: 50%;
}
.push-seven {
left: 58.333%;
}
.pull-seven {
right: 58.333%;
}
.push-eight {
left: 66.667%;
}
.pull-eight {
right: 66.667%;
}
.push-nine {
left: 75%;
}
.pull-nine {
right: 75%;
}
.push-ten {
left: 83.333%;
}
.pull-ten {
right: 83.333%;
}
img, object, embed {
max-width: 100%;
height: auto;
}
img {
-ms-interpolation-mode: bicubic;
}
#map_canvas img, .map_canvas img {
max-width: none !important;
}
/* Nicolas Gallagher's micro clearfix */
.row {
*zoom: 1;
}
.row:before, .row:after {
content: "";
display: table;
}
.row:after {
clear: both;
}
/* Block Grids ---------------------- */
/* These are 2-up, 3-up, 4-up and 5-up ULs, suited
for repeating blocks of content. Add 'mobile' to
them to switch them just like the layout grid
(one item per line) on phones
For IE7/8 compatibility block-grid items need to be
the same height. You can optionally uncomment the
lines below to support arbitrary height, but know
that IE7/8 do not support :nth-child.
-------------------------------------------------- */
.block-grid {
display: block;
overflow: hidden;
padding: 0;
}
.block-grid > li {
display: block;
height: auto;
float: left;
}
.block-grid.two-up {
margin: 0 -15px;
}
.block-grid.two-up > li {
width: 50%;
padding: 0 15px 15px;
}
/* .block-grid.two-up>li:nth-child(2n+1) {clear: left;} */
.block-grid.three-up {
margin: 0 -12px;
}
.block-grid.three-up > li {
width: 33.33%;
padding: 0 12px 12px;
}
/* .block-grid.three-up>li:nth-child(3n+1) {clear: left;} */
.block-grid.four-up {
margin: 0 -10px;
}
.block-grid.four-up > li {
width: 25%;
padding: 0 10px 10px;
}
/* .block-grid.four-up>li:nth-child(4n+1) {clear: left;} */
.block-grid.five-up {
margin: 0 -8px;
}
.block-grid.five-up > li {
width: 20%;
padding: 0 8px 8px;
}
.uls-lcd-region-section h3 {
color: #777;
}
.uls-lcd-region-section ul li:hover {
background-color: #eaeff7;
}
/* Language list */
.uls-language-list {
height: 22em;
overflow: auto;
margin: 10px;
width: auto;
}
.uls-language-block ul {
margin: 0px 0px 1.6em;
}
.uls-language-list ul li {
cursor: pointer;
font-weight: normal;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.uls-language-list strong {
text-decoration: underline;
}
.uls-language-list a {
font-weight: normal;
text-decoration: none;
color: #3366bb;
font-size: 14px;
line-height: 1.6em;
}
.uls-language-block .three.columns {
width: 22%;
}
.uls-language-block {
width: 100%;
}
.uls-no-results-view {
color: #555;
height: 100%;
}
.uls-no-results-view h2{
font-weight: bold;
}
#uls-no-found-more {
font-size: 0.9em;
background: #F8F8F8;
width: 100%;
margin-top: 1.6em;
line-height: 1.6em;
position:absolute;
bottom:0;
left:0;
}
.uls-lcd-region-section ul li.uls-column-break:hover {
background: none;
}

View File

@@ -1,320 +0,0 @@
/* Generated using Foundation http://foundation.zurb.com/docs/grid.php */
/* Global Reset & Standards ---------------------- */
.uls-menu * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* Misc ---------------------- */
.left {
float: left;
}
.right {
float: right;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.hide {
display: none;
}
.highlight {
background: #ffff99;
}
/* The Grid ---------------------- */
.row {
width: 100%;
max-width: none;
min-width: 600px;
margin: 0 auto;
}
.row .row {
width: auto;
max-width: none;
min-width: 0;
margin: 0 -5px;
}
.row.collapse .column, .row.collapse .columns {
padding: 0;
}
.row .row {
width: auto;
max-width: none;
min-width: 0;
margin: 0 -5px;
}
.row .row.collapse {
margin: 0;
}
.column, .columns {
float: left;
min-height: 1px;
padding: 0 5px;
position: relative;
}
.column.centered, .columns.centered {
float: none;
margin: 0 auto;
}
.row .one {
width: 8.333%;
}
.row .two {
width: 16.667%;
}
.row .three {
width: 25%;
}
.row .four {
width: 33.333%;
}
.row .five {
width: 41.667%;
}
.row .six {
width: 50%;
}
.row .seven {
width: 58.333%;
}
.row .eight {
width: 66.667%;
}
.row .nine {
width: 75%;
}
.row .ten {
width: 83.333%;
}
.row .eleven {
width: 91.667%;
}
.row .twelve {
width: 100%;
}
.row .offset-by-one {
margin-left: 8.333%;
}
.row .offset-by-two {
margin-left: 16.667%;
}
.row .offset-by-three {
margin-left: 25%;
}
.row .offset-by-four {
margin-left: 33.333%;
}
.row .offset-by-five {
margin-left: 41.667%;
}
.row .offset-by-six {
margin-left: 50%;
}
.row .offset-by-seven {
margin-left: 58.333%;
}
.row .offset-by-eight {
margin-left: 66.667%;
}
.row .offset-by-nine {
margin-left: 75%;
}
.row .offset-by-ten {
margin-left: 83.333%;
}
.push-two {
left: 16.667%;
}
.pull-two {
right: 16.667%;
}
.push-three {
left: 25%;
}
.pull-three {
right: 25%;
}
.push-four {
left: 33.333%;
}
.pull-four {
right: 33.333%;
}
.push-five {
left: 41.667%;
}
.pull-five {
right: 41.667%;
}
.push-six {
left: 50%;
}
.pull-six {
right: 50%;
}
.push-seven {
left: 58.333%;
}
.pull-seven {
right: 58.333%;
}
.push-eight {
left: 66.667%;
}
.pull-eight {
right: 66.667%;
}
.push-nine {
left: 75%;
}
.pull-nine {
right: 75%;
}
.push-ten {
left: 83.333%;
}
.pull-ten {
right: 83.333%;
}
img, object, embed {
max-width: 100%;
height: auto;
}
img {
-ms-interpolation-mode: bicubic;
}
#map_canvas img, .map_canvas img {
max-width: none !important;
}
/* Nicolas Gallagher's micro clearfix */
.row {
*zoom: 1;
}
.row:before, .row:after {
content: "";
display: table;
}
.row:after {
clear: both;
}
/* Block Grids ---------------------- */
/* These are 2-up, 3-up, 4-up and 5-up ULs, suited
for repeating blocks of content. Add 'mobile' to
them to switch them just like the layout grid
(one item per line) on phones
For IE7/8 compatibility block-grid items need to be
the same height. You can optionally uncomment the
lines below to support arbitrary height, but know
that IE7/8 do not support :nth-child.
-------------------------------------------------- */
.block-grid {
display: block;
overflow: hidden;
padding: 0;
}
.block-grid > li {
display: block;
height: auto;
float: left;
}
.block-grid.two-up {
margin: 0 -15px;
}
.block-grid.two-up > li {
width: 50%;
padding: 0 15px 15px;
}
/* .block-grid.two-up>li:nth-child(2n+1) {clear: left;} */
.block-grid.three-up {
margin: 0 -12px;
}
.block-grid.three-up > li {
width: 33.33%;
padding: 0 12px 12px;
}
/* .block-grid.three-up>li:nth-child(3n+1) {clear: left;} */
.block-grid.four-up {
margin: 0 -10px;
}
.block-grid.four-up > li {
width: 25%;
padding: 0 10px 10px;
}
/* .block-grid.four-up>li:nth-child(4n+1) {clear: left;} */
.block-grid.five-up {
margin: 0 -8px;
}
.block-grid.five-up > li {
width: 20%;
padding: 0 8px 8px;
}

View File

@@ -1,70 +0,0 @@
.uls-lcd-region-section h3 {
color: #777;
}
.uls-lcd-region-section ul li:hover {
background-color: #eaeff7;
}
/* Language list */
.uls-language-list {
height: 22em;
overflow: auto;
margin: 10px;
width: auto;
}
.uls-language-block ul {
margin: 0px 0px 1.6em;
}
.uls-language-list ul li {
cursor: pointer;
font-weight: normal;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.uls-language-list strong {
text-decoration: underline;
}
.uls-language-list a {
font-weight: normal;
text-decoration: none;
color: #3366bb;
font-size: 14px;
line-height: 1.6em;
}
.uls-language-block .three.columns {
width: 22%;
}
.uls-language-block {
width: 100%;
}
.uls-no-results-view {
color: #555;
height: 100%;
}
.uls-no-results-view h2{
font-weight: bold;
}
#uls-no-found-more {
font-size: 0.9em;
background: #F8F8F8;
width: 100%;
margin-top: 1.6em;
line-height: 1.6em;
position:absolute;
bottom:0;
left:0;
}
.uls-lcd-region-section ul li.uls-column-break:hover {
background: none;
}

View File

@@ -1,578 +0,0 @@
languages:
aa: [Latn, [AF], Qafár af]
ab: [Cyrl, [EU], Аҧсшәа]
ace: [Latn, [AS, PA], Acèh]
ady-cyrl: [Cyrl, [EU], Адыгэбзэ]
ady-latn: [Latn, [EU], Adygabze]
# XXX multiple script
# ady: [[Cyrl, Latn], [EU], [Адыгэбзэ, Adygabze]]
ady: [Cyrl, [EU], Адыгэбзэ]
aeb: [Arab, [AF], زَوُن]
af: [Latn, [AF], Afrikaans]
ahr: [Deva, [AS], अहिराणी]
ak: [Latn, [AF], Akan]
akz: [Latn, [AM], Albaamo innaaɬiilka]
aln: [Latn, [EU], Gegë]
am: [Ethi, [AF], አማርኛ]
an: [Latn, [EU], aragonés]
ang: [Latn, [EU], Ænglisc]
anp: [Deva, [AS], अङ्गिका]
ar: [Arab, [ME], العربية]
arc: [Syrc, [ME], ܐܪܡܝܐ]
arn: [Latn, [AM], mapudungun]
aro: [Latn, [AM], Araona]
arq: [Latn, [AF], Dziri]
ary: [Latn, [ME], Maġribi]
arz: [Arab, [ME], مصرى]
as: [Beng, [AS], অসমীয়া]
ase: [Sgnw, [AM], American sign language]
ast: [Latn, [EU], asturianu]
av: [Cyrl, [EU], авар]
avk: [Latn, [WW], Kotava]
ay: [Latn, [AM], Aymar aru]
# also Arab, and in the past - Cyrl
az: [Latn, [EU, ME], azərbaycanca]
ba: [Cyrl, [EU], башҡортса]
bar: [Latn, [EU], Boarisch]
bbc-latn: [Latn, [AS], Batak Toba]
# FIXME
bbc: [Batk, [AS], Batak Toba/Batak autonym unknown]
bcc: [Arab, [AS, ME], بلوچی مکرانی]
bcl: [Latn, [AS], Bikol Central]
# FIXME: which is the correct code?
be-tarask: [Cyrl, [EU], беларуская (тарашкевіца)]
be-x-old: [Cyrl, [EU], беларуская (тарашкевіца)]
be: [Cyrl, [EU], беларуская]
bew: [Latn, [AS], Bahasa Betawi]
bfq: [Taml, [AS], படகா]
bg: [Cyrl, [EU], български]
bh: [Deva, [AS], भोजपुरी]
bho: [Deva, [AS], भोजपुरी]
bi: [Latn, [PA], Bislama]
bjn: [Latn, [AS], Bahasa Banjar]
bm: [Latn, [AF], bamanankan]
bn: [Beng, [AS], বাংলা]
bo: [Tibt, [AS], བོད་ཡིག]
bpy: [Beng, [AS], বিষ্ণুপ্রিয়া মণিপুরী]
bqi: [Arab, [ME], بختياري]
br: [Latn, [EU], brezhoneg]
brh: [Latn, [ME, AS], Bráhuí]
bs: [Latn, [EU], bosanski]
bto: [Latn, [AS], Iriga Bicolano]
bug: [Bugi, [AS], ᨅᨔ ᨕᨘᨁᨗ]
bxr: [Cyrl, [AS], буряад]
ca: [Latn, [EU], català]
cbk-zam: [Latn, [AS], Chavacano de Zamboanga]
cdo: [Latn, [AS], Mìng-dĕ̤ng-ngṳ̄]
ce: [Cyrl, [EU], нохчийн]
ceb: [Latn, [AS], Cebuano]
ch: [Latn, [PA], Chamoru]
cho: [Latn, [AM], Choctaw]
chr: [Cher, [AM], ᏣᎳᎩ]
chy: [Latn, [AM], Tsetsêhestâhese]
ckb: [Arab, [ME], کوردی]
co: [Latn, [EU], corsu]
cps: [Latn, [AS], Capiceño]
cr-cans: [Cans, [AM], ᓀᐦᐃᔭᐍᐏᐣ]
cr-latn: [Latn, [AM], Nēhiyawēwin]
# XXX multiple script
# cr: [[Latn, Cans], [AM], [Nēhiyawēwin, ᓀᐦᐃᔭᐍᐏᐣ]]
cr: [Cans, [AM], Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ]
crh-cyrl: [Cyrl, [EU], къырымтатарджа (Кирилл)]
crh-latn: [Latn, [EU], qırımtatarca (Latin)]
# XXX multiple script
# Latn is default in Wikipedia, Cyrl is common IRL
# crh: [[Cyrl, Latn], [EU], [къырымтатарджа, qırımtatarca]]
crh: [Latn, [EU], къырымтатарджа / qırımtatarca]
cs: [Latn, [EU], česky]
csb: [Latn, [EU], kaszëbsczi]
# FIXME: what script?
cu: [Cyrl, [EU], словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ]
cv: [Cyrl, [EU], Чӑвашла]
cy: [Latn, [EU], Cymraeg]
da: [Latn, [EU], dansk]
de-at: [Latn, [EU], Österreichisches Deutsch]
de-ch: [Latn, [EU], Schweizer Hochdeutsch]
de-formal: [Latn, [EU], Deutsch (Sie-Form)]
de: [Latn, [EU], Deutsch]
diq: [Latn, [EU, AS], Zazaki]
dsb: [Latn, [EU], dolnoserbski]
dtp: [Latn, [AS], Dusun Bundu-liwan]
dv: [Thaa, [AS], ދިވެހިބަސް]
dz: [Tibt, [AS], ཇོང་ཁ]
ee: [Latn, [AF], eʋegbe]
egl: [Latn, [EU], Emiliàn]
el: [Grek, [EU], Ελληνικά]
eml: [Latn, [EU], emiliàn e rumagnòl]
en-ca: [Latn, [AM], Canadian English]
en-gb: [Latn, [EU, AS, PA], British English]
# world?
en: [Latn, [EU, AM, AF, ME, AS, PA, WW], English]
eo: [Latn, [WW], Esperanto]
es-419: [Latn, [AM], espanol de America Latina]
# world?
es-formal: [Latn, [EU, AM, AF, WW], Español (formal)]
# world?
es: [Latn, [EU, AM, AF, WW], español]
esu: [Latn, [AM], "Yup'ik"]
et: [Latn, [EU], eesti]
eu: [Latn, [EU], euskara]
ext: [Latn, [EU], estremeñu]
fa: [Arab, [ME], فارسی]
ff: [Latn, [AF], Fulfulde]
fi: [Latn, [EU], suomi]
fit: [Latn, [EU], meänkieli]
fj: [Latn, [PA], Na Vosa Vakaviti]
fo: [Latn, [EU], føroyskt]
fr: [Latn, [EU, AM, WW], français]
frc: [Latn, [EU], français cadien]
frp: [Latn, [EU], arpetan]
frr: [Latn, [EU], Nordfriisk]
fur: [Latn, [EU], furlan]
fy: [Latn, [EU], Frysk]
ga: [Latn, [EU], Gaeilge]
gag: [Latn, [EU], Gagauz]
gah: [Latn, [AS], Alekano]
gan-hans: [Hans, [AS], 赣语(简体)]
gan-hant: [Hant, [AS], 贛語(繁體)]
gan: [Hant, [AS], 贛語]
gbz: [Latn, [AS], Dari]
gcf: [Latn, [AM], Guadeloupean Creole French]
gd: [Latn, [EU], Gàidhlig]
gl: [Latn, [EU], galego]
glk: [Arab, [ME], گیلکی]
gn: [Latn, [AM], "Avañe'ẽ"]
gom-deva: [Deva, [AS], कोंकणी]
gom-latn: [Latn, [AS], Konknni]
# XXX multiple script
# gom: [[Deva, Latn], [AS], [कोंकणी, Konknni]]
gom: [Deva, [AS], कोंकणी / Konknni]
# hmph?..
got: [Goth, [EU], 𐌲𐌿𐍄𐌹𐍃𐌺]
grc: [Grek, [EU], Ἀρχαία ἑλληνικὴ]
gsw: [Latn, [EU], Alemannisch]
gu: [Gujr, [AS], ગુજરાતી]
guc: [Latn, [AM], Wayúu]
gur: [Latn, [AF], Gurenɛ]
gv: [Latn, [EU], Gaelg]
# The name in Names.php is Arabic, but everything else is Latn
ha: [Latn, [AF], هَوُسَ]
hak: [Latn, [AS], Hak-kâ-fa]
haw: [Latn, [AM, PA], Hawai`i]
he: [Hebr, [ME], עברית]
# Or maybe world?
hi: [Deva, [AS], हिन्दी]
hif-deva: [Deva, [AS], फ़ीजी हिन्दी]
hif-latn: [Latn, [PA, AS], Fiji Hindi]
# XXX multiple script
# hif: [[Deva, Latn], [PA, AS], [फ़ीजी हिन्दी, Fiji Hindi]]
hif: [Latn, [PA, AS], फ़ीजी हिन्दी / Fiji Hindi]
hil: [Latn, [AS], Ilonggo]
hne: [Deva, [AS], छत्तीसगढ़ी]
ho: [Latn, [PA], Hiri Motu]
hr: [Latn, [EU], hrvatski]
hsb: [Latn, [EU], hornjoserbsce]
hsn: [Hans, [AS], 湘语]
# Haitian Creole. North America, right?
ht: [Latn, [AM], Kreyòl ayisyen]
hu-formal: [Latn, [EU], Magyar (magázó)]
hu: [Latn, [EU], magyar]
hy: [Armn, [EU, ME], Հայերեն]
hz: [Latn, [AF], Otsiherero]
ia: [Latn, [WW], interlingua]
id: [Latn, [AS], Bahasa Indonesia]
ie: [Latn, [WW], Interlingue]
ig: [Latn, [AF], Igbo]
ii: [Yiii, [AS], ꆇꉙ]
ik: [Latn, [AM], Iñupiak]
ike-cans: [Cans, [AM], ᐃᓄᒃᑎᑐᑦ]
ike-latn: [Latn, [AM], inuktitut]
ilo: [Latn, [AS], Ilokano]
inh: [Cyrl, [EU], ГӀалгӀай]
io: [Latn, [WW], Ido]
is: [Latn, [EU], íslenska]
it: [Latn, [EU], italiano]
# For variants ike-* is used
iu: [Cans, [AM], ᐃᓄᒃᑎᑐᑦ/inuktitut]
ja: [Jpan, [AS], 日本語]
jam: [Latn, [AM], Patois]
jbo: [Latn, [WW], Lojban]
jut: [Latn, [EU], jysk]
# also in the Javanese script (Java), but the Wikipedia is in Latn
jv: [Latn, [AS, PA], Basa Jawa]
ka: [Geor, [EU], ქართული]
kaa: [Latn, [AS], Qaraqalpaqsha]
# Can also be Tfng, but the Wikipedia is mostly Latn
kab: [Latn, [AF, EU], Taqbaylit]
kbd-cyrl: [Cyrl, [EU, ME], Адыгэбзэ]
kbd-latn: [Latn, [EU], Qabardjajəbza]
kbd: [Cyrl, [EU, ME], Адыгэбзэ]
kea: [Latn, [AF], Kabuverdianu]
kg: [Latn, [AF], Kongo]
kgp: [Latn, [AM], Kaingáng]
khw: [Arab, [ME, AS], کھوار]
ki: [Latn, [AF], Gĩkũyũ]
kiu: [Latn, [EU, ME], Kırmancki]
kj: [Latn, [AF], Kwanyama]
kk-arab: [Arab, [EU, AS], قازاقشا (تٴوتە)]
kk-cn: [Arab, [EU, AS, ME], قازاقشا (جۇنگو)]
kk-cyrl: [Cyrl, [EU, AS], қазақша (кирил)]
kk-kz: [Cyrl, [EU, AS], қазақша (Қазақстан)]
kk-latn: [Latn, [EU, AS, ME], qazaqşa (latın)]
kk-tr: [Latn, [EU, AS, ME], qazaqşa (Türkïya)]
# XXX multiple script
# kk: [[Arab, Cyrl, Latn] [EU, AS], [قازاقشا, қазақша, qazaqşa]]
kk: [Cyrl, [EU, AS], қазақша / قازاقشا / qazaqşa]
kl: [Latn, [AM, EU], kalaallisut]
km: [Khmr, [AS], ភាសាខ្មែរ]
kn: [Knda, [AS], ಕನ್ನಡ]
# Here Hang may be even more appropriate, because kp has more resistance to Han
ko-kp: [Kore, [AS], 한국어 (조선)]
# Kore is an alias for Hangul+Han. Maybe Hang is more appropriate?
ko: [Kore, [AS], 한국어]
koi: [Cyrl, [EU], Перем Коми]
kr: [Latn, [AF], Kanuri]
krc: [Cyrl, [EU], къарачай-малкъар]
kri: [Latn, [AF], Krio]
krj: [Latn, [ME, EU], Kinaray-a]
krl: [Latn, [EU], Karjala]
ks-arab: [Arab, [AS], کٲشُر]
ks-deva: [Deva, [AS], कॉशुर]
# XXX multiple script
# Arab is first here just because it's the current default in the Wikipedia. Deva may be needed, too.
# ks: [[Deva, Arab], [AS], [कॉशुर, کٲشُر]]
ks: [Arab, [AS], कॉशुर / کٲشُر]
ksf: [Latn, [AF], Bafia]
ksh: [Latn, [EU], Ripoarisch]
ku-arab: [Arab, [EU, ME], كوردي (عەرەبی)]
ku-latn: [Latn, [EU, ME], Kurdî (latînî)]
# XXX multiple script
# ku: [[Arab, Latn], [EU, ME], [كوردي , Kurdî]]
ku: [Latn, [EU, ME], كوردي / Kurdî]
kv: [Cyrl, [EU], коми]
kw: [Latn, [EU], kernowek]
ky: [Cyrl, [AS], Кыргызча]
la: [Latn, [EU], Latina]
# Most identified with Turkey, Bulgaria, Greece, Spain and Israel,
# but also spoken in Latin America and elsewhere.
# Wikipedia is mostly in Latn, but also in Hebr. (Comparable to az.)
lad: [Latn, [ME, EU, AM], Ladino]
lb: [Latn, [EU], Lëtzebuergesch]
lbe: [Cyrl, [EU], лакку]
lez: [Cyrl, [EU], лезги]
lfn: [Latn, [WW], Lingua Franca Nova]
lg: [Latn, [AF], Luganda]
li: [Latn, [EU], Limburgs]
lij: [Latn, [EU], Ligure]
liv: [Latn, [EU], Līvõ kēļ]
lld: [Latn, [EU], Ladin]
lmo: [Latn, [EU], lumbaart]
ln: [Latn, [AF], lingála]
lo: [Laoo, [AS], ລາວ]
loz: [Latn, [AF], Silozi]
lt: [Latn, [EU], lietuvių]
ltg: [Latn, [EU], latgaļu]
lus: [Latn, [AS], Mizo ţawng]
lv: [Latn, [EU], latviešu]
lzh: [Hant, [AS], 文言]
# Also Geor, but the incubator is in Latn
lzz: [Latn, [EU, ME], Lazuri]
mai: [Deva, [AS], मैथिली]
map-bms: [Latn, [AS], Basa Banyumasan]
mdf: [Cyrl, [EU], мокшень]
mfe: [Latn, [AM], Morisyen]
mg: [Latn, [AF], Malagasy]
mh: [Latn, [PA], Ebon]
mhr: [Cyrl, [EU], олык марий]
mi: [Latn, [PA], Māori]
mic: [Latn, [AM], "Mi'kmaq"]
min: [Latn, [AS], Baso Minangkabau]
mk: [Cyrl, [EU], македонски]
ml: [Mlym, [AS, ME], മലയാളം]
# Hmm, can also have Mong some day in some way
mn: [Cyrl, [AS], монгол]
mnc: [Mong, [AS], ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ]
mni: [Beng, [AS], মেইতেই লোন্]
mnw: [Mymr, [AS], ဘာသာ မန်]
mo: [Cyrl, [EU], молдовеняскэ]
mr: [Deva, [AS, ME], मराठी]
mrj: [Cyrl, [EU], кырык мары]
ms: [Latn, [AS], Bahasa Melayu]
mt: [Latn, [EU], Malti]
mui: [Latn, [AS], Musi]
mus: [Latn, [AM], Mvskoke]
mwl: [Latn, [EU], Mirandés]
mwv: [Latn, [AS], Behase Mentawei]
my: [Mymr, [AS], မြန်မာဘာသာ]
myv: [Cyrl, [EU], эрзянь]
mzn: [Arab, [ME, AS], مازِرونی]
na: [Latn, [PA], Dorerin Naoero]
nah: [Latn, [AM], Nāhuatl]
nan: [Latn, [AS], Bân-lâm-gú]
nap: [Latn, [EU], Nnapulitano]
nb: [Latn, [EU], norsk (bokmål)]
nds-nl: [Latn, [EU], Nedersaksisch]
nds: [Latn, [EU], Plattdüütsch]
ne: [Deva, [AS], नेपाली]
new: [Deva, [AS], नेपाल भाषा]
ng: [Latn, [AF], Oshiwambo]
niu: [Latn, [PA], ko e vagahau Niuē]
njo: [Latn, [AS], Ao]
nl-informal: [Latn, [EU, AM], Nederlands (informeel)]
nl: [Latn, [EU, AM], Nederlands]
nn: [Latn, [EU], norsk (nynorsk)]
"no": [Latn, [EU]]
nov: [Latn, [WW], Novial]
nqo: [Nkoo, [AF], ߒߞߏ]
nrm: [Latn, [EU], Nouormand]
nso: [Latn, [AF], Sesotho sa Leboa]
nv: [Latn, [AM], Diné bizaad]
ny: [Latn, [AF], Chi-Chewa]
oc: [Latn, [EU], occitan]
om: [Latn, [AF], Oromoo]
or: [Orya, [AS], ଓଡ଼ିଆ]
os: [Cyrl, [EU], Ирон]
pa: [Guru, [AS], ਪੰਜਾਬੀ]
pag: [Latn, [AS], Pangasinan]
pam: [Latn, [AS], Kapampangan]
pap: [Latn, [AM], Papiamentu]
pcd: [Latn, [EU], Picard]
pdc: [Latn, [EU, AM], Deitsch]
pdt: [Latn, [EU, AM], Plautdietsch]
pfl: [Latn, [EU], Pälzisch]
pi: [Deva, [AS], पाळि]
pih: [Latn, [PA], Norfuk / Pitkern]
pis: [Latn, [PA], Pijin]
pko: [Latn, [AF], Pökoot]
pl: [Latn, [EU], polski]
pms: [Latn, [EU], Piemontèis]
pnb: [Arab, [AS, ME], پنجابی]
pnt: [Grek, [EU], Ποντιακά]
ppl: [Latn, [AM], Nawat]
prg: [Latn, [EU], Prūsiskan]
pru: [Latn, [EU], Prūsiskan]
ps: [Arab, [AS, ME], پښتو]
pt-br: [Latn, [AM], português do Brasil]
# world?
pt: [Latn, [EU, AM, AS, PA, AF, WW], português]
qu: [Latn, [AM], Runa Simi]
qug: [Latn, [AM], Runa shimi]
rap: [Latn, [AM], arero rapa nui]
rgn: [Latn, [EU], Rumagnôl]
rif: [Latn, [AF], Tarifit]
rki: [Mymr, [AS], ရခိုင်]
rm: [Latn, [EU], rumantsch]
rmy: [Latn, [EU], Romani]
rn: [Latn, [AF], Kirundi]
ro: [Latn, [EU], română]
roa-rup: [Latn, [EU], Armãneashce]
roa-tara: [Latn, [EU], tarandíne]
rtm: [Latn, [PA], Faeag Rotuma]
# world?
ru: [Cyrl, [EU, AS, ME], русский]
rue: [Cyrl, [EU], русиньскый]
rup: [Latn, [EU], Armãneashce]
ruq: [Latn, [EU], Vlăheşte]
ruq-cyrl: [Cyrl, [EU], Влахесте]
# FIXME: broken autonym
ruq-grek: [Grek, [EU], Megleno-Romanian (Greek script)]
ruq-latn: [Latn, [EU], Vlăheşte]
rw: [Latn, [AF], Kinyarwanda]
ryu: [Kana, [AS], ʔucināguci]
sa: [Deva, [AS], संस्कृतम्]
# Russian Far East - Europe, Asia, or both?
sah: [Cyrl, [EU, AS], саха тыла]
# Currently Latn, potentially Olck
sat: [Latn, [AS], Santali]
saz: [Saur, [AS], ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ]
sc: [Latn, [EU], sardu]
scn: [Latn, [EU], sicilianu]
sco: [Latn, [EU], Scots]
sd: [Arab, [AS], سنڌي]
sdc: [Latn, [EU], Sassaresu]
se: [Latn, [EU], sámegiella]
sei: [Latn, [AM], Cmique Itom]
sg: [Latn, [AF], Sängö]
sgs: [Latn, [EU], žemaitėška]
sh-cyrl: [Cyrl, [EU], српскохрватски]
sh-latn: [Latn, [EU], srpskohrvatski]
# XXX multiple script
# sh: [[Latn, Cyrl], [EU], [srpskohrvatski, српскохрватски]]
sh: [Latn, [EU], srpskohrvatski / српскохрватски]
shi-latn: [Latn, [AF], Tašlḥiyt]
shi-tfng: [Tfng, [AF], ⵜⴰⵛⵍⵃⵉⵜ]
# XXX multiple script
# shi: [[Latn, Tfng], [AF], [Tašlḥiyt, ⵜⴰⵛⵍⵃⵉⵜ]]
shi: [Latn, [AF], Tašlḥiyt / ⵜⴰⵛⵍⵃⵉⵜ]
shn: [Mymr, [AS], လိၵ်ႈတႆး]
si: [Sinh, [AS], සිංහල]
simple: [Latn, [WW], Simple English]
sk: [Latn, [EU], slovenčina]
sl: [Latn, [EU], slovenščina]
sli: [Latn, [EU], Schläsch]
slr: [Latn, [AS], Salırça]
sly: [Latn, [AS], Bahasa Selayar]
sm: [Latn, [PA], Gagana Samoa]
sma: [Latn, [EU], åarjelsaemien]
smj: [Latn, [EU], julevsámegiella]
smn: [Latn, [EU], anarâškielâ]
sms: [Latn, [EU], sää´mǩiõll]
sn: [Latn, [AF], chiShona]
so: [Latn, [AF], Soomaaliga]
sq: [Latn, [EU], shqip]
sr-ec: [Cyrl, [EU], српски (ћирилица)]
sr-el: [Latn, [EU], srpski (latinica)]
# XXX multiple script
# sr: [[Cyrl, Latn], [EU], [српски, srpski]]
sr: [Cyrl, [EU], српски / srpski]
srn: [Latn, [AM, EU], Sranantongo]
ss: [Latn, [AF], SiSwati]
st: [Latn, [AF], Sesotho]
stq: [Latn, [EU], Seeltersk]
su: [Latn, [AS], Basa Sunda]
sv: [Latn, [EU], svenska]
sw: [Latn, [AF], Kiswahili]
swb: [Latn, [AF], Shikomoro]
sxu: [Latn, [EU], Säggssch]
szl: [Latn, [EU], ślůnski]
ta: [Taml, [AS], தமிழ்]
tcy: [Knda, [AS], ತುಳು]
te: [Telu, [AS], తెలుగు]
tet: [Latn, [AS, PA], tetun]
tg-cyrl: [Cyrl, [AS], тоҷикӣ]
tg-latn: [Latn, [AS], tojikī]
tg: [Cyrl, [AS], тоҷикӣ]
th: [Thai, [AS], ไทย]
ti: [Ethi, [AF], ትግርኛ]
tk: [Latn, [AS], Türkmençe]
tkr: [Cyrl, [AS], ЦӀаьхна миз]
tl: [Latn, [AS], Tagalog]
# A very complicated case. Names.php is Cyrl. In TWN they argue about Cyrl, Latn, and Arab. I can't find reliable external sources. --Amir
tly: [Cyrl, [EU, AS, ME], толышә зывон]
tn: [Latn, [AF], Setswana]
to: [Latn, [PA], lea faka-Tonga]
tokipona: [Latn, [WW], Toki Pona]
tpi: [Latn, [PA, AS], Tok Pisin]
tr: [Latn, [EU, ME], Türkçe]
trp: [Latn, [AS], Kokborok (Tripuri)]
tru: [Latn, [AS], Ṫuroyo]
ts: [Latn, [AF], Xitsonga]
tsd: [Grek, [EU], Τσακωνικά]
tt-cyrl: [Cyrl, [EU], татарча]
tt-latn: [Latn, [EU], tatarça]
# XXX multiple script
# tt: [[Cyrl, Latn] [EU], [татарча, tatarça]]
tt: [Cyrl, [EU], татарча / tatarça]
ttt: [Cyrl, [AS], Tati]
tum: [Latn, [AF], chiTumbuka]
tw: [Latn, [AF], Twi]
twd: [Latn, [EU], Tweants]
ty: [Latn, [PA], Reo Mā`ohi]
tyv: [Cyrl, [AS], тыва дыл]
tzm: [Tfng, [AF], ⵜⴰⵎⴰⵣⵉⵖⵜ]
udm: [Cyrl, [EU], удмурт]
ug-arab: [Arab, [AS], ئۇيغۇرچە]
ug-latn: [Latn, [AS], Uyghurche]
# XXX multiple script
# ug: [[Arab, Latn], [AS], [ئۇيغۇرچە, Uyghurche]]
ug: [Arab, [AS], ئۇيغۇرچە / Uyghurche ]
uk: [Cyrl, [EU], українська]
ur: [Arab, [AS, ME], اردو]
uz: [Latn, [AS], oʻzbekcha]
ve: [Latn, [AF], Tshivenda]
vec: [Latn, [EU], vèneto]
vep: [Latn, [EU], vepsän kel]
vi: [Latn, [AS], Tiếng Việt]
vls: [Latn, [EU], West-Vlams]
vmf: [Latn, [EU], Mainfränkisch]
vo: [Latn, [WW], Volapük]
vot: [Latn, [EU], Vaďďa]
vro: [Latn, [EU], Võro]
wa: [Latn, [EU], walon]
war: [Latn, [AS], Winaray]
wls: [Latn, [PA], "Faka'uvea"]
wo: [Latn, [AF], Wolof]
wuu: [Hans, [EU], 吴语]
xal: [Cyrl, [EU], хальмг]
xh: [Latn, [AF], isiXhosa]
xmf: [Geor, [EU], მარგალური]
ydd: [Hebr, [AS, EU], Eastern Yiddish]
yi: [Hebr, [ME, EU, AM], ייִדיש]
yo: [Latn, [AF], Yorùbá]
yrk: [Cyrl, [AS], Ненэцяʼ вада]
yrl: [Latn, [AM], "ñe'engatú"]
yua: [Latn, [AM], "Maaya T'aan"]
# world?
yue: [Hant, [AS], 粵語]
za: [Latn, [AS], Vahcuengh]
zea: [Latn, [EU], Zeêuws]
zh-classical: [Hant, [AS], 文言]
zh-cn: [Hans, [AS], 中文(中国大陆)]
zh-hans: [Hans, [AS], 中文(简体)]
zh-hant: [Hant, [AS], 中文(繁體)]
zh-hk: [Hant, [AS], 中文(香港)]
zh-min-nan: [Latn, [AS], Bân-lâm-gú]
zh-mo: [Hant, [AS], 中文(澳門)]
zh-my: [Hans, [AS], 中文(马来西亚)]
zh-sg: [Hans, [AS], 中文(新加坡)]
zh-tw: [Hant, [AS], 中文(台灣)]
zh-yue: [Hans, [AS], 粵語]
zh: [Hans, [AS], 中文]
zu: [Latn, [AF], isiZulu]
# The codes are taken from http://unicode.org/iso15924/iso15924-codes.html .
#
# The classification is roughly based on http://www.unicode.org/charts/
# 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:
# The group name "Other" is reserved.
# It's hard to find a better place for Goth except the Latin group.
Latin: [Latn, Goth]
# Greek is probalby different enough from Latin and Cyrillic, but user testing
# may prove otherwise.
Greek: [Grek]
WestCaucasian: [Armn, Geor]
Arabic: [Arab]
# Maybe MiddleEastern can be unified with Arabic.
# Maybe Thaana can be moved here from SouthAsian.
# Maybe it can be unified with African.
MiddleEastern: [Hebr, Syrc]
African: [Ethi, Nkoo, Tfng]
# India, Nepal, Bangladesh, Sri-Lanka, Bhutan, Maldives.
#
# Thaana (Thaa, the script of Maldives) is here, even though it's RTL,
# because it's closer geographically to India. Maybe it should be moved
# to MiddleEastern or to Arabic, if that would be easier to users.
#
# Tibetan (Tibt) is here, even though it's classified as "Central Asian" by
# Unicode, because linguistically and geographically it's closely related to
# the Brahmic family.
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]
Mongolian: [Mong]
SignWriting: [Sgnw]
NativeAmerican: [Cher, Cans]
rtlscripts:
[Arab, Hebr, Syrc, Nkoo, Thaa]
# The numbers are also used in HTML id attributes
regiongroups:
# Worldwide, international
WW: 1
# America
AM: 2
# Europe
EU: 3
# Middle East
ME: 3
# Africa
AF: 3
# Asia
AS: 4
# Pacific
PA: 4

File diff suppressed because it is too large Load Diff

View File

@@ -1,80 +0,0 @@
<?php
/**
* Script to create the language data in JSON format for ULS.
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
* contributors. See CREDITS for a list.
*
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
* have to do anything special to choose one license or the other and you don't
* have to notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @file
* @ingroup Extensions
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
include __DIR__ . '/spyc.php';
print( "Reading langdb.yaml...\n" );
$yamlLangdb = file_get_contents( 'langdb.yaml' );
$parsedLangdb = spyc_load( $yamlLangdb );
$supplementalDataFilename = 'supplementalData.xml';
$supplementalDataUrl = "http://unicode.org/repos/cldr/trunk/common/supplemental/$supplementalDataFilename";
$curl = curl_init( $supplementalDataUrl );
$supplementalDataFile = fopen( $supplementalDataFilename, 'w' );
curl_setopt( $curl, CURLOPT_FILE, $supplementalDataFile );
curl_setopt( $curl, CURLOPT_HEADER, 0 );
print( "Trying to download $supplementalDataUrl...\n" );
$curlSuccess = curl_exec( $curl );
curl_close( $curl );
fclose( $supplementalDataFile );
if ( !$curlSuccess ) {
die( "Failed to download CLDR data from $supplementalDataUrl.\n" );
}
print( "Downloaded $supplementalDataFilename, trying to parse...\n" );
$supplementalData = simplexml_load_file( $supplementalDataFilename );
if ( !( $supplementalData instanceof SimpleXMLElement ) ) {
die( "Attempt to load CLDR data from $supplementalDataFilename failed.\n" );
}
print( "CLDR supplemental data parsed successfully, reading territories info...\n" );
$parsedLangdb['territories'] = array();
foreach ( $supplementalData->territoryInfo->territory as $territoryRecord ) {
$territoryAtributes = $territoryRecord->attributes();
$territoryCodeAttr = $territoryAtributes['type'];
$territoryCode = "$territoryCodeAttr[0]";
$parsedLangdb['territories'][$territoryCode] = array();
foreach ( $territoryRecord->languagePopulation as $languageRecord ) {
$languageAttributes = $languageRecord->attributes();
$languageCodeAttr = $languageAttributes['type'];
$parsedLangdb['territories'][$territoryCode][] = "$languageCodeAttr[0]";
}
}
print( "Writing JSON langdb...\n" );
$json = json_encode( $parsedLangdb );
$js = <<<JAVASCRIPT
// Please do not edit. This file is generated from data/langdb.yaml by ulsdata2json.php
( function ( $ ) {
$.uls = $.uls || {};
$.uls.data = $json;
} ( jQuery ) );
JAVASCRIPT;
file_put_contents( '../src/jquery.uls.data.js', $js );
print( "Done.\n" );

View File

@@ -1,54 +0,0 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8"/>
<!--
Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess
-->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>Universal Language Selector</title>
<!-- <link rel="shortcut icon" href="/favicon.ico"/> -->
<!-- <link rel="apple-touch-icon" href="/apple-touch-icon.png"/> -->
<!-- <meta name="description" content=""/> -->
<meta name="author" content="Santhosh Thottingal"/>
<link href="../css/jquery.uls.css" rel="stylesheet"/>
<link href="../css/jquery.uls.grid.css" rel="stylesheet"/>
<link href="../css/jquery.uls.lcd.css" rel="stylesheet"/>
<!-- demo -->
<link href="resources/demo.css" rel="stylesheet"/>
<!-- Libs -->
<script src="resources/jquery.js"></script>
<!-- Source -->
<script src="../src/jquery.uls.data.js"></script>
<script src="../src/jquery.uls.data.utils.js"></script>
<script src="../src/jquery.uls.lcd.js"></script>
<script src="../src/jquery.uls.languagefilter.js"></script>
<script src="../src/jquery.uls.regionfilter.js"></script>
<script src="../src/jquery.uls.core.js"></script>
<script>
$( document ).ready( function() {
$( '.uls-trigger' ).uls( {
onSelect : function( language ) {
var languageName = $.uls.data.autonym( language );
$('a#pageLanguage').text( languageName );
},
quickList: ['en', 'hi', 'he', 'ml', 'ta','fr'] //FIXME
} );
} );
</script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<span class="active uls-trigger"> <a id="pageLanguage" href="#">Select Language</a> </span>
<h1>Universal Language Selector</h1>
<p>
Demonstration of jquery plugin
</p>
</div>
<div class="container"></div>
</body>
</html>

View File

@@ -1,20 +0,0 @@
body {
padding-left: 10%;
padding-right: 10%;
font-family: Arial, Helvetica, sans-serif;
}
a {
text-decoration: none;
}
div.navbar {
background-color: #333;
color: #FFFFFF;
padding: 20px;
}
span.uls-trigger {
float: right;
}
span.uls-trigger a {
color: #FFFFFF;
font-weight: bold;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,85 +0,0 @@
/*global module:false*/
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-css');
// Project configuration.
grunt
.initConfig({
pkg : '<json:package.json>',
meta : {
banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - '
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n'
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>'
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;'
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
concat : {
js : {
src: [ '<banner:meta.banner>','src/jquery.uls.data.js',
'src/jquery.uls.data.utils.js', 'src/jquery.uls.lcd.js',
'src/jquery.uls.languagefilter.js', 'src/jquery.uls.regionfilter.js',
'src/jquery.uls.core.js'],
dest : 'dist/<%= pkg.name %>.js'
},
css: {
src: [ 'css/jquery.uls.css', 'css/jquery.uls.grid.css',
'css/jquery.uls.lcd.css' ],
dest : 'dist/<%= pkg.name %>.css'
}
},
min : {
dist : {
src : [ '<banner:meta.banner>',
'<config:concat.js.dest>' ],
dest : 'dist/<%= pkg.name %>.min.js'
}
},
cssmin : {
dist: {
src : '<config:concat.css.dest>',
dest : 'dist/<%= pkg.name %>.min.css'
}
},
lint : {
files : [ 'src/**/*.js', 'test/**/*.js' ]
},
csslint : {
file: [ 'css/**/*.css' ]
},
watch : {
files : '<config:lint.files>',
tasks : 'lint'
},
jshint : {
options : {
curly : true,
eqeqeq : true,
immed : true,
latedef : true,
newcap : true,
noarg : true,
sub : true,
undef : true,
boss : true,
eqnull : true,
browser : true,
smarttabs : true,
laxbreak : true,
multistr: true
},
globals : {
jQuery : true,
QUnit : true,
pluralRuleParser : true,
_ : true,
module : true,
test : true
}
},
uglify : {
src : [ '<banner:meta.banner>', '<config:concat.dist.js>' ],
dest : 'dist/<%= pkg.name %>.min.js'
}
});
// Default task.
grunt.registerTask('default', 'lint cssmin concat min csslint');
};

View File

@@ -0,0 +1,3 @@
{
"uls-select-language": "Wählen Sie eine Sprache"
}

View File

@@ -0,0 +1,20 @@
{
"@metadata": {
"author": "Santhosh Thottingal <santhosh.thottingal@gmail.com>",
"last-updated": "2012-09-21",
"locale": "en",
"message-documentation": "qqq"
},
"uls-select-language": "Select Language",
"uls-region-WW": "Worldwide",
"uls-region-AM": "America",
"uls-region-AF": "Africa",
"uls-region-EU": "Europe",
"uls-region-AS": "Asia",
"uls-region-ME": "Middle East",
"uls-region-PA": "Pacific",
"uls-no-results-found": "No results found",
"uls-common-languages": "Common languages",
"uls-no-results-suggestion-title": "You may be interested in:",
"uls-search-help": "You can search by language name, script name, ISO code of language or you can browse by region:"
}

View File

@@ -0,0 +1,3 @@
{
"uls-select-language": "Seleccione el idioma"
}

View File

@@ -0,0 +1,3 @@
{
"uls-select-language": "Valitse kieli"
}

View File

@@ -0,0 +1,20 @@
{
"@metadata": {
"author": "Amire80",
"last-updated": "2012-09-21",
"locale": "he",
"message-documentation": "qqq"
},
"uls-select-language": "בחירת שפה",
"uls-region-WW": "עולמי",
"uls-region-AM": "אמריקה",
"uls-region-AF": "אפריקה",
"uls-region-EU": "אירופה",
"uls-region-AS": "אסיה",
"uls-region-ME": "המזרח התיכון",
"uls-region-PA": "האוקיינוס השקט",
"uls-no-results-found": "לא נמצאו שפות",
"uls-common-languages": "שפות נפוצות",
"uls-no-results-suggestion-title": "אולי זה יעזור:",
"uls-search-help": "אפשר לחפש לפי שם שפה, שם שיטת הכתב וקוד ISO של השפה, או לעיין לפי אזור:"
}

View File

@@ -0,0 +1,3 @@
{
"uls-select-language": "भाषा चुनें"
}

View File

@@ -0,0 +1,3 @@
{
"uls-select-language": "言語を選択する"
}

View File

@@ -0,0 +1,14 @@
{
"uls-select-language": "ഭാഷ തിരഞ്ഞെടുക്കുക",
"uls-region-WW": "ആഗോള ഭാഷകൾ",
"uls-region-AM": "അമേരിക്ക",
"uls-region-AF": "ആഫ്രിക്ക",
"uls-region-EU": "യൂറോപ്പ്",
"uls-region-AS": "ഏഷ്യ",
"uls-region-ME": "മദ്ധ്യപൂർവേഷ്യ",
"uls-region-PA": "പസഫിക്",
"uls-no-results-found": "ഒന്നും കണ്ടെത്താനായില്ല",
"uls-common-languages": "സാധാരണ ഭാഷകൾ",
"uls-no-results-suggestion-title": "ഒരു പക്ഷേ ഇതായിരിക്കും നിങ്ങൾ തിരഞ്ഞത്:",
"uls-search-help": "നിങ്ങൾക്ക് ഭാഷയുടെ പേര്, ISO 639 കോഡ്, ലിപിയുടെ പേര് എന്നിവ ഉപയോഗിച്ച് തിരയാം. അല്ലെങ്കിൽ ഈ മേഖലകളിൽ തിരയാം:"
}

View File

@@ -0,0 +1,3 @@
{
"uls-select-language": "Selecteer taal"
}

View File

@@ -0,0 +1,19 @@
{
"@metadata": {
"author": "Santhosh Thottingal <santhosh.thottingal@gmail.com>",
"last-updated": "2012-09-21",
"locale": "qqq"
},
"uls-select-language": "Language Selector Title",
"uls-region-WW": "Label for worldwide languages. They are languages spoken in multiple countries. Eg: English, French, Spanish etc. This lable is used in the map region of ULS and as the title of section showing worldwide languages. Translation should not be descriptive.",
"uls-region-AM": "Label for America",
"uls-region-AF": "Label for Africa",
"uls-region-EU": "Label for Europe",
"uls-region-AS": "Label for Asia",
"uls-region-ME": "Label for Middle East",
"uls-region-PA": "Label for Pacific",
"uls-no-results-found": "Title text for 'No results found' section",
"uls-common-languages": "Title for languages listed based on GeoIP, previously used languaguage, browser accept-language etc.",
"uls-no-results-suggestion-title": "Title for language suggestion in 'no results found' screen",
"uls-search-help": "Help text for searching. After this text, there will be a set of links for regions"
}

View File

@@ -0,0 +1,3 @@
{
"uls-select-language": "மொழி தேர்வு"
}

1460
lib/jquery.uls/jquery.uls.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,53 +0,0 @@
{
"name": "jquery.uls",
"version": "0.1.0",
"description": "Universal Language Selector",
"homepage": "https://github.com/wikimedia/jquery.uls",
"keywords": [
"internationalization",
"localization",
"uls",
"jquery",
"l10n"
],
"author": {
"name": "Santhosh Thottingal",
"email": "santhosh.thottingal@gmail.com"
},
"contributors": [
"Alolita Sharma",
"Amir Aharoni",
"Arun Ganesh",
"Brandon Harris",
"Niklas Laxström",
"Pau Giner",
"Santhosh Thottingal",
"Siebrand Mazeland"
],
"dependencies": {},
"devDependencies": {
"grunt": "~0.3.9",
"grunt-compare-size": ">=0.1.4",
"grunt-css": ">0.0.0"
},
"repository": {
"type": "git",
"url": "git://github.com/wikimedia/jquery.uls.git"
},
"bugs": {
"url" : "http://github.com/wikimedia/jquery.uls/issues"
},
"engine": {
"node": ">=0.6.x"
},
"licenses": [
{
"type": "GPL",
"url": "https://github.com/wikimedia/jquery.uls/blob/master/GPL-LICENSE"
},
{
"type": "MIT",
"url": "https://github.com/wikimedia/jquery.uls/blob/master/MIT-LICENSE"
}
]
}

View File

@@ -1,320 +0,0 @@
/**
* Universal Language Selector
* ULS core component.
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
* contributors. See CREDITS for a list.
*
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
* have to do anything special to choose one license or the other and you don't
* have to notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @file
* @ingroup Extensions
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
(function ( $ ) {
"use strict";
// Region numbers in id attributes also appear in the langdb.
var template = '\
<div class="uls-menu"> \
<div class="row"> \
<span id="uls-close" class="icon-close"></span> \
</div> \
<div class="row"> \
<div class="uls-title four columns">\
<h1>Select language</h1>\
</div>\
<div class="three columns" id="settings-block"></div>\
<div class="five columns" id="map-block">\
<div class="row">\
<div data-regiongroup="1" id="uls-region-1" class="three columns uls-region">\
<a>Worldwide</a>\
</div>\
<div class="nine columns">\
<div class="row uls-worldmap">\
<div data-regiongroup="2" id="uls-region-2" class="four columns uls-region">\
<a>America</a>\
</div>\
<div data-regiongroup="3" id="uls-region-3" class="four columns uls-region">\
<a>Europe <br> Middle East <br> Africa\
</a>\
</div>\
<div data-regiongroup="4" id="uls-region-4" class="four columns uls-region">\
<a>Asia <br> Pacific\
</a>\
</div>\
</div>\
</div>\
</div>\
</div>\
</div>\
<div id="search" class="row"> \
<div class="one column">\
<span class="search-label"></span>\
</div>\
<div class="ten columns">\
<div id="search-input-block">\
<input type="text" class="filterinput" id="filtersuggestion" disabled="true"\
autocomplete="off" /> <input type="text" class="filterinput" id="languagefilter"\
data-clear="languagefilter-clear" data-suggestion="filtersuggestion"\
placeholder="Language search" autocomplete="off" />\
</div>\
</div>\
<div class="one column">\
<span id="languagefilter-clear"></span>\
</div>\
</div>\
<div class="row uls-language-list"></div>\
</div> ';
/**
* ULS Public class definition
*/
var ULS = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.uls.defaults, options );
this.$menu = $( template );
this.languages = this.options.languages;
for ( var code in this.languages ) {
if ( $.uls.data.languages[code] === undefined ) {
if ( window.console && window.console.log ) {
window.console.log( "ULS: Unknown language " + code + "." );
}
delete this.languages[code];
}
}
this.left = this.options.left;
this.top = this.options.top;
this.shown = false;
this.initialized = false;
this.$languageFilter = this.$menu.find( 'input#languagefilter' );
this.$regionFilters = this.$menu.find( '.uls-region' );
this.$resultsView = this.$menu.find( 'div.uls-language-list' );
this.render();
this.listen();
this.ready();
};
ULS.prototype = {
constructor: ULS,
ready: function() {
if ( this.options.onReady ) {
this.options.onReady( this );
}
},
/**
* Calculate the position of ULS
* Returns an object with top and left properties.
* @returns {Object}
*/
position: function() {
var pos = $.extend( {}, this.$element.offset(), {
height: this.$element[0].offsetHeight
} );
return {
top: this.top || pos.top + pos.height,
left: this.left || '25%'
};
},
/**
* Show the ULS window
*/
show: function() {
var pos = this.position();
this.$menu.css( {
top: pos.top,
left: '25%'
} );
if ( !this.initialized ) {
$( 'body' ).prepend( this.$menu );
// Initialize with a full search.
// This happens on first time click of uls trigger.
this.defaultSearch();
this.initialized = true;
}
this.$menu.show();
this.shown = true;
this.$languageFilter.focus();
},
defaultSearch: function() {
this.$resultsView.lcd( 'empty' );
this.$regionFilters.first().regionselector( 'show' );
},
/**
* Hide the ULS window
*/
hide: function() {
this.$menu.hide();
this.shown = false;
},
/**
* Render the UI elements.
* Does nothing by default. Can be used for customization.
*/
render: function() {
// Rendering stuff here
},
/**
* callback for no results found context.
* @param String search the search term
*/
noresults: function( search ) {
this.$resultsView.lcd( 'noResults' );
},
/**
* callback for results found context.
*/
success: function() {
this.$resultsView.show();
},
/**
* Bind the UI elements with their event listeners
*/
listen: function() {
var lcd,
that = this;
// Register all event listeners to the ULS here.
that.$element.on( 'click', $.proxy( that.click, that ) );
that.$languageFilter.on( 'seachclear', $.proxy( that.defaultSearch, that ) );
// Handle click on close button
this.$menu.find( "#uls-close" ).on( 'click', $.proxy( that.hide, that ) );
// Handle key press events on the menu
that.$menu.on('keypress', $.proxy(this.keypress, this) )
.on('keyup', $.proxy(this.keyup, this) );
if ( $.browser.webkit || $.browser.msie ) {
this.$menu.on( 'keydown', $.proxy( this.keypress, this ) );
}
lcd = that.$resultsView.lcd( {
languages: that.languages,
quickList: that.options.quickList,
clickhandler: $.proxy( that.onSelect, that )
} ).data( "lcd" );
that.$languageFilter.languagefilter( {
$target: lcd,
languages: that.languages,
success: function() {
$( '.regionselector' ).removeClass( 'active' );
that.success();
},
noresults: function() {
$( '.regionselector' ).removeClass( 'active' );
that.noresults();
},
searchAPI: that.options.searchAPI,
onSelect: $.proxy( that.onSelect, that )
} );
// Create region selectors, one per region
this.$menu.find( '.uls-region, .uls-region-link' ).regionselector( {
$target: lcd,
languages: that.languages,
success: function( regionfilter ) {
// Deactivate search filtering
that.$languageFilter.languagefilter( 'deactivate' );
// If it is WW region, show the quicklist
if ( regionfilter.regionGroup === 1 ) {
lcd.quicklist();
}
// Show 'results view' if we are in no results mode
that.success();
},
noresults: function() {
that.$languageFilter.languagefilter( 'clear' );
}
} );
},
/**
* On select handler for search results
* @param langCode
*/
onSelect: function( langCode ) {
this.hide();
if ( this.options.onSelect ) {
this.options.onSelect.call( this, langCode );
}
},
keyup: function( e ) {
if ( !this.shown ) {
return;
}
if ( e.keyCode === 27 ) { // escape
this.hide();
e.preventDefault();
e.stopPropagation();
}
},
keypress: function( e ) {
if ( !this.shown ) {
return;
}
if ( e.keyCode === 27 ) { // escape
this.hide();
e.preventDefault();
e.stopPropagation();
}
},
click: function( e ) {
e.stopPropagation();
e.preventDefault();
if ( !this.shown ) {
this.show();
}
}
};
/* ULS PLUGIN DEFINITION
* =========================== */
$.fn.uls = function( option ) {
return this.each( function() {
var $this = $( this ),
data = $this.data( 'uls' ),
options = typeof option === 'object' && option;
if ( !data ) {
$this.data( 'uls', ( data = new ULS( this, options ) ) );
}
if ( typeof option === 'string' ) {
data[option]();
}
} );
};
$.fn.uls.defaults = {
menu: template,
onSelect: null, // Callback function to be called when a language is selected
searchAPI: null, // Language search API
languages: $.uls.data.autonyms(), // Languages to be used for ULS, default is all languages
quickList: null // Array of language codes of function that returns such
};
$.fn.uls.Constructor = ULS;
} ( jQuery ) );

File diff suppressed because one or more lines are too long

View File

@@ -1,350 +0,0 @@
/**
* Utility functions for querying language data.
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
* contributors. See CREDITS for a list.
*
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
* have to do anything special to choose one license or the other and you don't
* have to notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @file
* @ingroup Extensions
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
(function ( $ ) {
"use strict";
/**
* Returns the script of the language.
* @param string language code
* @return string
*/
$.uls.data.script = function( language ) {
return $.uls.data.languages[language][0];
};
/**
* Returns the regions in which a language is spoken.
* @param string language code
* @return array of strings
*/
$.uls.data.regions = function( language ) {
return ( $.uls.data.languages[language] && $.uls.data.languages[language][1] ) || 'UNKNOWN';
};
/**
* Returns the autonym of the language.
* @param string language code
* @return string
*/
$.uls.data.autonym = function( language ) {
return ( $.uls.data.languages[language] && $.uls.data.languages[language][2] ) || language;
};
/**
* Returns all language codes and corresponding autonyms
* @return array
*/
$.uls.data.autonyms = function() {
var autonymsByCode = {};
for ( var language in $.uls.data.languages ) {
autonymsByCode[language] = $.uls.data.autonym( language );
}
return autonymsByCode;
};
/**
* Returns an array of all region codes.
* @return array
*/
$.uls.data.allRegions = function() {
var allRegions = [];
for( var region in $.uls.data.regiongroups ) {
allRegions.push( region );
}
return allRegions;
};
/**
* Returns all languages written in script.
* @param script string
* @return array of strings (languages codes)
*/
$.uls.data.languagesInScript = function( script ) {
return $.uls.data.languagesInScripts( [ script ] );
};
/**
* Returns all languages written in the given scripts.
* @param scripts array of strings
* @return array of strings (languages codes)
*/
$.uls.data.languagesInScripts = function( scripts ) {
var languagesInScripts = [];
for ( var language in $.uls.data.languages ) {
for ( var i = 0; i < scripts.length; i++ ) {
if ( scripts[i] === $.uls.data.script(language) ) {
languagesInScripts.push( language );
break;
}
}
}
return languagesInScripts;
};
/**
* Returns all languages in a given region.
* @param region string
* @return array of strings (languages codes)
*/
$.uls.data.languagesInRegion = function( region ) {
return $.uls.data.languagesInRegions( [ region ] );
};
/**
* Returns all languages in given regions.
* @param region array of strings.
* @return array of strings (languages codes)
*/
$.uls.data.languagesInRegions = function( regions ) {
var languagesInRegions = [];
for ( var language in $.uls.data.languages ) {
for ( var i = 0; i < regions.length; i++ ) {
if ( $.inArray( regions[i], $.uls.data.regions( language ) ) !== -1 ) {
languagesInRegions.push( language );
break;
}
}
}
return languagesInRegions;
};
/**
* Returns all languages in a region group.
* @param groupNum number.
* @return array of strings (languages codes)
*/
$.uls.data.languagesInRegionGroup = function( groupNum ) {
return $.uls.data.languagesInRegions( $.uls.data.regionsInGroup( groupNum ) );
};
/**
* Returns an associative array of languages in a region,
* grouped by script.
* @param string region code
* @return associative array
*/
$.uls.data.languagesByScriptInRegion = function( region ) {
var languagesByScriptInRegion = {};
for ( var language in $.uls.data.languages ) {
if ( $.inArray( region, $.uls.data.regions( language ) ) !== -1 ) {
var script = $.uls.data.script( language );
if ( languagesByScriptInRegion[script] === undefined ) {
languagesByScriptInRegion[script] = [];
}
languagesByScriptInRegion[script].push( language );
}
}
return languagesByScriptInRegion;
};
/**
* Returns an associative array of languages in a region,
* grouped by script group.
* @param string region code
* @return associative array
*/
$.uls.data.languagesByScriptGroupInRegion = function( region ) {
return $.uls.data.languagesByScriptGroupInRegions( [ region ] );
};
/**
* Returns an associative array of all languages,
* grouped by script group.
* @return associative array
*/
$.uls.data.allLanguagesByScriptGroup = function() {
return $.uls.data.languagesByScriptGroupInRegions( $.uls.data.allRegions() );
};
/**
* Get the given list of languages grouped by script.
* @param languages Array of language codes
* @return {Object} Array of languages indexed by script codes
*/
$.uls.data.languagesByScriptGroup = function( languages ) {
var languagesByScriptGroup = {},
scriptGroup,
language,
langScriptGroup;
for ( scriptGroup in $.uls.data.scriptgroups ) {
for ( language in languages ) {
langScriptGroup = $.uls.data.scriptGroupOfLanguage( language );
if( langScriptGroup !== scriptGroup ) {
continue;
}
if ( !languagesByScriptGroup[scriptGroup] ) {
languagesByScriptGroup[scriptGroup] = [];
}
languagesByScriptGroup[scriptGroup].push( language );
}
}
return languagesByScriptGroup;
};
/**
* Returns an associative array of languages in several regions,
* grouped by script group.
* @param array of strings - region codes
* @return associative array
*/
$.uls.data.languagesByScriptGroupInRegions = function( regions ) {
var languagesByScriptGroupInRegions = {};
for ( var language in $.uls.data.languages ) {
for ( var i = 0; i < regions.length; i++ ) {
if ( $.inArray( regions[i], $.uls.data.regions( language ) ) !== -1 ) {
var scriptGroup = $.uls.data.scriptGroupOfLanguage( language );
if ( languagesByScriptGroupInRegions[scriptGroup] === undefined ) {
languagesByScriptGroupInRegions[scriptGroup] = [];
}
languagesByScriptGroupInRegions[scriptGroup].push( language );
break;
}
}
}
return languagesByScriptGroupInRegions;
};
/**
* Returns an array of languages grouped by region group,
* region, script group and script.
* @return associative array
*/
$.uls.data.allLanguagesByRegionAndScript = function() {
var allLanguagesByRegionAndScript = {},
region,
regionGroup;
for ( region in $.uls.data.regiongroups ) {
regionGroup = $.uls.data.regiongroups[region];
if ( allLanguagesByRegionAndScript[regionGroup] === undefined ) {
allLanguagesByRegionAndScript[regionGroup] = {};
}
allLanguagesByRegionAndScript[regionGroup][region] = {};
}
for ( var language in $.uls.data.languages ) {
var script = $.uls.data.script( language );
var scriptGroup = $.uls.data.groupOfScript( script );
var regions = $.uls.data.regions( language );
for ( var regionNum = 0; regionNum < regions.length; regionNum++ ) {
region = regions[regionNum];
regionGroup = $.uls.data.regiongroups[region];
if ( allLanguagesByRegionAndScript[regionGroup][region][scriptGroup] === undefined ) {
allLanguagesByRegionAndScript[regionGroup][region][scriptGroup] = {};
}
if ( allLanguagesByRegionAndScript[regionGroup][region][scriptGroup][script] === undefined ) {
allLanguagesByRegionAndScript[regionGroup][region][scriptGroup][script] = [];
}
allLanguagesByRegionAndScript[regionGroup][region][scriptGroup][script].push( language );
}
}
return allLanguagesByRegionAndScript;
};
/**
* Returns all regions in a region group.
* @param number groupNum
* @return array of strings
*/
$.uls.data.regionsInGroup = function( groupNum ) {
var regionsInGroup = [];
for ( var region in $.uls.data.regiongroups ) {
if ( $.uls.data.regiongroups[region] === groupNum ) {
regionsInGroup.push( region );
}
}
return regionsInGroup;
};
/**
* Returns the script group of a script or 'Other' if it doesn't
* belong to any group.
* @param string script code
* @return string script group name
*/
$.uls.data.groupOfScript = function( script ) {
for ( var group in $.uls.data.scriptgroups ) {
if ( $.inArray( script, $.uls.data.scriptgroups[group] ) !== -1 ) {
return group;
}
}
return 'Other';
};
/**
* Returns the script group of a language.
* @param string language code
* @return string script group name
*/
$.uls.data.scriptGroupOfLanguage = function( language ) {
return $.uls.data.groupOfScript( $.uls.data.script( language ) );
};
/**
* A callback for sorting languages by autonym.
* Can be used as an argument to a sort function.
* @param two language codes
*/
$.uls.data.sortByAutonym = function( a, b ) {
var autonymA = $.uls.data.autonym( a ) || a,
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;
};
/**
* Returns the languages spoken in a territory.
* @param string Territory code
* @return list of language codes
*/
$.uls.data.languagesInTerritory = function( territory ) {
return $.uls.data.territories[territory];
};
} ( jQuery ) );

View File

@@ -1,298 +0,0 @@
/**
* jQuery language filter plugin.
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
* contributors. See CREDITS for a list.
*
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
* have to do anything special to choose one license or the other and you don't
* have to notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @file
* @ingroup Extensions
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
/**
* Usage: $( 'inputbox' ).languagefilter();
* The values for autocompletion is from the options.languages.
* The data is in the format of languagecode:languagename.
*/
(function ( $ ) {
"use strict";
var LanguageFilter = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.regionselector.defaults, options );
this.$element.addClass( 'languagefilter' );
this.resultCount = 0;
this.$suggestion = this.$element.parents().find( '#' + this.$element.data( 'suggestion' ) );
this.$clear = this.$element.parents().find( '#'+ this.$element.data( 'clear' ) );
this.selectedLanguage = null;
this.listen();
};
var delay = ( function() {
var timer = 0;
return function( callback, milliseconds ) {
clearTimeout( timer );
timer = setTimeout( callback, milliseconds );
};
} () );
LanguageFilter.prototype = {
listen: function() {
this.$element.on( 'keypress', $.proxy( this.keyup, this ) )
.on( 'keyup', $.proxy( this.keyup, this ) );
if ( $.browser.webkit || $.browser.msie ) {
this.$element.on( 'keydown', $.proxy( this.keyup, this ) );
}
if ( this.$clear.length ) {
this.$clear.on( 'click' , $.proxy( this.clear, this ) );
}
this.toggleClear();
},
keyup: function( e ) {
switch( e.keyCode ) {
case 9: // Tab -> Autocomplete
var suggestion = this.$suggestion.val();
if ( suggestion && suggestion !== this.$element.val() ) {
this.$element.val( suggestion );
e.preventDefault();
e.stopPropagation();
}
break;
case 13: // Enter
if ( !this.options.onSelect ) {
break;
}
var query = $.trim( this.$element.val() ).toLowerCase();
if ( this.selectedLanguage ) {
// this.selectLanguage will be populated from a matching search
this.options.onSelect( this.selectedLanguage );
} else if ( this.options.languages[query] ) {
// Search is yet to happen (in timeout delay),
// but we have a matching language code.
this.options.onSelect( query );
}
break;
default:
var that = this;
this.selectedLanguage = null;
delay( function() {
if ( !that.$element.val() ) {
that.clear();
} else {
that.options.$target.empty();
that.search();
}
}, 300 );
this.toggleClear();
}
},
/**
* Clears the current search removing
* clear buttons and suggestions.
*/
deactivate: function() {
this.$element.val( '' );
this.$element.focus();
this.toggleClear();
this.autofill();
},
/**
* Clears the search and shows all languages
*/
clear: function() {
this.deactivate();
this.$element.trigger( 'seachclear' );
},
/**
* Toggles the visibility of clear icon depending
* on whether there is anything to clear.
*/
toggleClear: function() {
if ( !this.$clear.length ) {
return;
}
if ( this.$element.val() ) {
this.$clear.show();
} else {
this.$clear.hide();
}
},
search: function() {
var query = $.trim( this.$element.val() ),
languages = $.uls.data.languagesByScriptGroup( this.options.languages ),
scriptGroup, langNum, langCode;
this.resultCount = 0;
for ( scriptGroup in languages ) {
var languagesInScript = languages[scriptGroup];
languagesInScript.sort( $.uls.data.sortByAutonym );
for ( langNum = 0; langNum < languagesInScript.length; langNum++ ) {
langCode = languagesInScript[langNum];
if ( query === "" || this.filter( langCode, query ) ) {
if ( this.resultCount === 0 ) {
// Autofill the first result.
this.autofill( langCode );
}
if ( query.toLowerCase() === langCode ) {
this.selectedLanguage = langCode;
}
this.render( langCode );
this.resultCount++;
}
}
}
// Also do a search by search API
if( !this.resultCount && this.options.searchAPI && query ) {
this.searchAPI( query );
} else {
this.resultHandler( query );
}
},
searchAPI: function( query ) {
var that = this;
$.get( that.options.searchAPI, { search: query }, function( result ) {
$.each( result['languagesearch'], function( code, name ) {
if ( that.resultCount === 0 ) {
// Autofill the first result.
that.autofill( code, name );
}
that.render( code );
that.resultCount++;
} );
that.resultHandler( query );
} );
},
/**
* Handler method to be called once search is over.
* Based on search result call success or noresults callbacks
* @param String query
*/
resultHandler: function( query ) {
if ( this.resultCount === 0 && this.options.noresults ) {
this.$suggestion.val( '' );
this.options.noresults.call( this, query );
} else if ( this.options.success ) {
this.options.success( this, query, this.resultCount );
}
},
autofill: function( langCode, languageName ) {
if ( !this.$suggestion.length ) {
return;
}
if ( !this.$element.val() ) {
this.$suggestion.val( '' );
return;
}
this.selectedLanguage = langCode;
languageName = languageName || this.options.languages[langCode];
var autonym,
userInput = this.$element.val(),
suggestion = userInput + languageName.substring( userInput.length, languageName.length );
if ( suggestion.toLowerCase() !== languageName.toLowerCase() ) {
// see if it was autonym match
autonym = $.uls.data.autonym( langCode ) || '';
suggestion = userInput + autonym.substring( userInput.length, autonym.length );
if ( suggestion !== autonym ) {
// Give up. It may be iso/script code match.
suggestion = "";
}
}
// Make sure that it is a visual prefix.
if ( !isVisualPrefix( userInput, suggestion ) ) {
suggestion = "";
}
this.$suggestion.val( suggestion );
},
render: function( langCode ) {
var $target = this.options.$target;
if ( !$target ) {
return;
}
$target.append( langCode, null );
},
escapeRegex: function( value ) {
return value.replace( /[\-\[\]{}()*+?.,\\\^$\|#\s]/g, "\\$&" );
},
/**
* A search match happens if any of the following passes:
* a) Language name in current user interface language
* 'starts with' search string.
* b) Language autonym 'starts with' search string.
* c) ISO 639 code match with search string.
* d) ISO 15924 code for the script match the search string.
*/
filter: function( langCode, searchTerm ) {
// FIXME script is ISO 15924 code. We might need actual name of script.
var matcher = new RegExp( "^" + this.escapeRegex( searchTerm ), 'i' ),
languageName = this.options.languages[langCode];
return matcher.test( languageName ) ||
matcher.test( $.uls.data.autonym( langCode ) ) ||
matcher.test( langCode ) ||
matcher.test( $.uls.data.script( langCode ) );
}
};
$.fn.languagefilter = function( option ) {
return this.each( function() {
var $this = $( this ),
data = $this.data( 'languagefilter' ),
options = typeof option === 'object' && option;
if ( !data ) {
$this.data( 'languagefilter', ( data = new LanguageFilter( this, options ) ) );
}
if ( typeof option === 'string' ) {
data[option]();
}
} );
};
$.fn.languagefilter.defaults = {
$target: null, // Where to append the results
searchAPI: null,
languages: null, // Languages as code:name format.
noresults: null, // callback for no results found case
success: null, // callback if any results found.
onSelect: null // Language select handler - like enter in filter textbox.
};
$.fn.languagefilter.Constructor = LanguageFilter;
/**
* Check if a prefix is visually prefix of a string
* @param String prefix
* @param String string
*/
function isVisualPrefix( prefix, string ) {
// Pre-base vowel signs of Indic languages. A vowel sign is called pre-base if
// consonant + vowel becomes [vowel][consonant] when rendered. Eg: ക + െ => കെ
var prebases = "െേൈൊോൌெேைொோௌେୈୋୌિਿिিেৈোৌෙේෛොෝෞ";
if ( prebases.indexOf( string[prefix.length] ) > 0 ) {
return false;
} else {
return true;
}
}
} ( jQuery ) );

View File

@@ -1,269 +0,0 @@
/**
* Universal Language Selector
* Language category display component - Used for showing the search results,
* grouped by regions, scripts
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
* contributors. See CREDITS for a list.
*
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
* have to do anything special to choose one license or the other and you don't
* have to notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @file
* @ingroup Extensions
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
(function( $ ) {
"use strict";
var noResultsTemplate = '\
<div class="twelve columns uls-no-results-view">\
<h2 class="eleven columns end offset-by-one">\
No results found\
</h2>\
<div id="uls-no-found-more">\
<div class="ten columns end offset-by-one">\
<p>\
You can search by language name, script name, ISO code of language or \
you can browse by region:\
<a class="uls-region-link" data-region="AM" href="#">America</a>,\
<a class="uls-region-link" data-region="EU" href="#">Europe</a>,\
<a class="uls-region-link" data-region="ME" href="#">Middle East</a>, \
<a class="uls-region-link" data-region="AF" href="#">Africa</a>,\
<a class="uls-region-link" data-region="AS" href="#">Asia</a>,\
<a class="uls-region-link" data-region="PA" href="#">Pacific</a> or \
<a class="uls-region-link" data-region="WW" href="#">Worldwide languages</a>.\
</p>\
</div>\
</div>\
</div>';
var LanguageCategoryDisplay = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.lcd.defaults, options );
this.$element.addClass( 'lcd' );
this.regionDivs = {};
this.$element.append( $(noResultsTemplate) );
this.$noResults = this.$element.find( 'div.uls-no-results-view' );
this.render();
this.listen();
};
LanguageCategoryDisplay.prototype = {
constructor: LanguageCategoryDisplay,
append: function( langCode, regionCode ) {
this.addToRegion( langCode, regionCode );
this.$noResults.hide();
},
/**
* Add the language to a region.
* If the region parameter is given, add to that region alone
* Otherwise to all regions that this language belongs.
* @param langCode
* @param region Optional region
*/
addToRegion: function( langCode, region ) {
var that = this;
var language = that.options.languages[langCode],
langName = $.uls.data.autonym( langCode ) || language || langCode,
regions = [];
if ( region ) {
regions.push( region );
} else {
regions = $.uls.data.regions( langCode );
}
// World wide languages need not be repeated in all regions.
if ( $.inArray( 'WW', regions ) > -1 ) {
regions = [ 'WW' ];
}
for ( var i = 0; i < regions.length; i++ ) {
var regionCode = regions[i];
var $li = $( '<li>' )
.data( 'code', langCode )
.append(
$( '<a>' ).prop( 'href', '#' ).prop( 'title', language ).html( langName )
);
// Append the element to the column in the list
var $column = that.getColumn( regionCode );
var lastLanguage = $column.find( 'li:last' ).data( 'code' );
if ( lastLanguage ) {
var lastScriptGroup = $.uls.data.scriptGroupOfLanguage( lastLanguage ),
currentScriptGroup = $.uls.data.scriptGroupOfLanguage( langCode );
if ( lastScriptGroup !== currentScriptGroup ) {
if ( $column.find( 'li' ).length > 2 ) {
// If column already has 2 or more languages, add a new column
$column = that.getColumn( regionCode, true );
}
}
}
$column.append( $li );
}
},
/**
* Get a column to add language.
* @param String regionCode The region code
* @param boolean forceNew whether a new column must be created or not
*/
getColumn: function( regionCode, forceNew ) {
var $divRegionCode, $rowDiv, $ul;
forceNew = forceNew || false;
$divRegionCode = this.regionDivs[regionCode];
$rowDiv = $divRegionCode.find( 'div.row:last' );
$ul = $rowDiv.find( 'ul:last' );
// Each column can have maximum 8 languages.
if ( $ul.length === 0 || $ul.find( 'li' ).length >= 8 || forceNew ) {
$ul = $( '<ul>' ).addClass( 'three columns end' );
if ( $rowDiv.length === 0 || $rowDiv.find( 'ul' ).length >= 4 ) {
$rowDiv = $( '<div>' ).addClass( 'row uls-language-block' );
$divRegionCode.append( $rowDiv );
$ul.addClass( 'offset-by-one' );
}
$rowDiv.append( $ul );
}
$divRegionCode.show();
return $ul;
},
render: function() {
var that = this;
var regions = { // FIXME Remove this when i18n is in place.
WW: 'Worldwide',
AM: 'America',
EU: 'Europe',
ME: 'Middle East',
AS: 'Asia',
AF: 'Africa',
PA: 'Pacific'
};
var $section;
$.each( $.uls.data.regiongroups, function( regionCode, regionIndex ) {
$section = $( '<div>' ).addClass( 'twelve columns uls-lcd-region-section' ).prop( 'id', regionCode );
$section.append( $( '<h3>' )
.addClass( 'eleven columns uls-lcd-region-section offset-by-one' )
.text( regions[regionCode] ) );
that.$element.append( $section );
$section.hide();
that.regionDivs[regionCode] = $section;
} );
this.$noResults.hide();
},
quicklist: function() {
if ( $.isFunction( this.options.quickList ) ) {
this.options.quickList = this.options.quickList();
}
if ( !this.options.quickList ) {
return;
}
// Pick only the first elements, because we don't have room for more
var quickList = this.options.quickList;
quickList = quickList.slice( 0, 16 );
quickList.sort( $.uls.data.sortByAutonym );
var $quickListsection = $( '<div>' ).addClass( 'twelve columns uls-lcd-region-section' ).prop( 'id', 'uls-lcd-quicklist' );
$quickListsection.append( $( '<h3>' ).addClass( 'eleven columns uls-lcd-region-section offset-by-one' ).text( 'Common languages' ) );
this.$element.prepend( $quickListsection );
this.regionDivs[ 'quick' ] = $quickListsection;
for ( var i = 0; i < quickList.length; i++) {
var $column = this.getColumn( 'quick', i % 4 === 0 );
var langCode = quickList[i];
var language = this.options.languages[langCode];
var langName = $.uls.data.autonym( langCode ) || language || langCode;
var $li = $( '<li>' )
.data( 'code', langCode )
.append(
$( '<a>' ).prop( 'href', '#' ).prop( 'title', language ).html( langName )
);
$column.append( $li );
}
$quickListsection.show();
return $quickListsection;
},
show: function() {
if ( !this.regionDivs ) {
this.render();
}
},
empty: function() {
this.$element.find( 'div.uls-language-block' ).remove();
this.$element.find( 'div.uls-lcd-region-section' ).hide();
},
focus: function() {
this.$element.focus();
},
noResults: function() {
this.$noResults.show();
var $suggestions = this.quicklist();
$suggestions.find( 'h3' ).text( 'You may be interested in' );
this.$noResults.find( 'h2' ).after( $suggestions );
},
listen: function() {
var that = this;
if ( this.options.clickhandler ) {
this.$element.on( 'click', 'div.row li', function() {
that.options.clickhandler.call( this, $( this ).data( 'code' ) );
} );
}
// The region section need to be in sync with the map filter.
that.$element.scroll( function () {
if ( this.offsetHeight + this.scrollTop >= this.scrollHeight ) {
that.$element.trigger( 'scrollend' );
}
} );
}
};
$.fn.lcd = function( option ) {
return this.each( function() {
var $this = $( this ),
data = $this.data( 'lcd' ),
options = typeof option === 'object' && option;
if ( !data ) {
$this.data( 'lcd', ( data = new LanguageCategoryDisplay( this, options ) ) );
}
if ( typeof option === 'string') {
data[option]();
}
} );
};
$.fn.lcd.defaults = {
languages: null
};
$.fn.lcd.Constructor = LanguageCategoryDisplay;
} ( jQuery ) );

View File

@@ -1,182 +0,0 @@
/**
* jQuery region filter plugin.
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
* contributors. See CREDITS for a list.
*
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
* have to do anything special to choose one license or the other and you don't
* have to notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @file
* @ingroup Extensions
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
(function ( $ ) {
"use strict";
/* RegionSelector plugin definition */
/**
* Region selector is a language selector based on regions.
* Usage: $( 'jqueryselector' ).regionselector( options );
* The attached element should have data-regiongroup attribute
* that defines the regiongroup for the selector.
*/
var RegionSelector = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.regionselector.defaults, options );
this.$element.addClass( 'regionselector' );
this.regions = [];
this.cache= null;
this.regionGroup = this.$element.data( 'regiongroup' );
this.init();
this.listen();
};
RegionSelector.prototype = {
constructor: RegionSelector,
init: function() {
var region = this.$element.data( 'region' );
this.regions = $.uls.data.regionsInGroup( this.regionGroup );
if ( region ) {
this.regions.push( region );
}
},
test: function( langCode ) {
var langRegions = $.uls.data.regions( langCode ),
region;
for ( var i = 0; i < this.regions.length; i++ ) {
region = this.regions[i];
if ( $.inArray( region, langRegions ) >= 0 ) {
this.render( langCode, region );
this.cache[langCode] = region;
return;
}
}
},
show: function() {
// Make the selected region (and it only) active
$( '.regionselector' ).removeClass( 'active' );
if ( this.regionGroup ) {
// if there is a region group, make it active.
this.$element.addClass( 'active' );
}
if ( this.cache ) {
// If the result cache is present, render the results from there.
var result = null;
for ( result in this.cache ) {
this.render( result, this.cache[result] );
}
} else {
this.cache = {};
// Get the languages grouped by script group
var languagesByScriptGroup = $.uls.data.languagesByScriptGroup( this.options.languages );
for ( var scriptGroup in languagesByScriptGroup ) {
// Get the languages for the script group
var languages = languagesByScriptGroup[scriptGroup];
// Sort it based on autonym
languages.sort( $.uls.data.sortByAutonym );
for ( var i = 0; i < languages.length; i++ ) {
// Check whether it belongs to the region
this.test( languages[i] );
}
}
}
if ( this.options.success ) {
this.options.success( this );
}
},
render: function( langCode, region ) {
var $target = this.options.$target;
if ( !$target ) {
return;
}
$target.append( langCode, region );
},
next: function () {
if ( !this.$element.hasClass( 'active') ) {
return true;
}
var that = this;
// Do not respond to all scroll end events, but only after a short interval
delay( function () {
var regiongroup = that.$element.data( 'regiongroup' );
var nextRegiongroup = regiongroup + 1;
var $nextRegion = $( '#uls-region-' + nextRegiongroup );
var next = $nextRegion.length && $nextRegion.data( 'regionselector' );
if ( next ) {
next.show();
}
}, 100 );
return false;
},
listen: function() {
this.$element.on( 'click', $.proxy( this.click, this ) );
this.options.$target.$element.bind( 'scrollend', $.proxy( this.next, this) );
},
click: function( e ) {
if( this.$element.hasClass( 'active' ) ) {
this.$element.removeClass( 'active' );
if ( this.options.noresults ) {
this.options.noresults.call();
}
} else {
// Re-populate the list of languages
this.options.$target.empty();
this.show();
}
}
};
/* RegionSelector plugin definition */
$.fn.regionselector = function( option ) {
return this.each( function() {
var $this = $( this ),
data = $this.data( 'regionselector' ),
options = typeof option === 'object' && option;
if ( !data ) {
$this.data( 'regionselector', ( data = new RegionSelector( this, options ) ) );
}
if ( typeof option === 'string' ) {
data[option]();
}
} );
};
$.fn.regionselector.defaults = {
$target: null, // Where to render the results
success: null, // callback if any results found.
noresults: null, // callback when no results to show
languages: null
};
$.fn.regionselector.Constructor = RegionSelector;
var delay = ( function () {
var timer = 0;
return function ( callback, milliseconds ) {
clearTimeout( timer );
timer = setTimeout( callback, milliseconds );
};
} () );
} ( jQuery ) );