[Pkg-javascript-commits] [languages4translatewiki] 01/02: Imported Upstream version 0.1.3

Per Andersson avtobiff-guest at moszumanska.debian.org
Sun Feb 16 22:12:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

avtobiff-guest pushed a commit to branch master
in repository languages4translatewiki.

commit b001062226395ae698662574ed37079ac69a6f1d
Author: Per Andersson <avtobiff at gmail.com>
Date:   Sun Feb 16 22:46:48 2014 +0100

    Imported Upstream version 0.1.3
---
 README.md                 | 111 ++++++++++
 build/build.sh            |  30 +++
 build/build_scrap.sh      |  31 +++
 build/footer.js           |  39 ++++
 build/header.js           |  27 +++
 build/scrap.js            |  58 +++++
 build/tw_api.js           |  59 +++++
 languages.js              | 539 ++++++++++++++++++++++++++++++++++++++++++++++
 languages.json            | 473 ++++++++++++++++++++++++++++++++++++++++
 languages.json.gz         | Bin 0 -> 6060 bytes
 languages.min.js          |   2 +
 languages.min.js.gz       | Bin 0 -> 6399 bytes
 package.json              |  22 ++
 test/browser-example.html |  45 ++++
 test/node-example.js      |  17 ++
 15 files changed, 1453 insertions(+)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7cf0bcc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,111 @@
+languages4translatewiki
+=======================
+
+This a enlarger version of [languages.js](https://github.com/joker-x/languages.js), for supporting all languages of [translatewiki.net](http://translatewiki.net).
+
+A basic and lightweight replacement for Globalize. Stores ISO 639 language database in a JSON object, accesible as node module or by browser javascript interpret. Without any dependencies.
+
+Features
+--------
+
+1.  The same file can be use from the server side in nodejs to the client side in javascript browser interpret.
+2.  Also includes the json file for using in other languages, for example PHP.
+3.  Supports 468 languages
+4.  Lightweight, only 12K or 6K gzipped.
+5.  Very basic too, but enough for a lot of projects: only return the ISO 639 language codes of supported languages, the nativeName and his own direction.
+6.  Contain a build script which call translatewiki api page for languages support, minimizes the code with uglify, and compresses it with gzip.
+
+Use
+---
+
+From javascript the JSON object is not accesible directly. You must use this public functions:
+
+*  **languages.isValid(langcode)**: *Return boolean value, true if langcode is supported.*
+*  **languages.getAllLanguageCode()**: *Return an array with all the language codes supported.*
+*  **languages.getLanguageInfo(langcode)**: *Return object {"nativeName", "direction"}.
+If langcode isn't supported return {}.*
+
+See the test folder for use examples:
+
+### From nodejs
+
+```js
+// From node the module is accesible with a simple require
+var languages = require ('../languages.min.js');
+var num_languages = 0;
+
+// languages.getAllLanguageCode() return an array of all ISO 639 language code supported
+var langscodes = languages.getAllLanguageCode();
+// iterate this array
+for (num_languages=0; num_languages<langscodes.length; num_languages++) {
+  // show a string representation of the object return by languages.getLanguageInfo(langcode)
+	console.log(langscodes[num_languages]);
+	console.log("   "+JSON.stringify(languages.getLanguageInfo(langscodes[num_languages])));
+}
+// show the number of languages supported
+console.log("Languages supported: "+num_languages);
+// test languages.isValid(langcode) function
+console.log("¿isValid 'kaka' language code? "+languages.isValid('kaka'));
+console.log("¿isValid 'es' language code? "+languages.isValid('es'));
+```
+
+### From browser
+
+```html
+<!doctype html>
+<html>
+<head>
+    <title>Test languages module</title>
+    <meta charset="utf-8"> 
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
+    <script src="../languages.min.js"></script>
+    <style>
+    body {
+        background-color: #eee;
+    }
+    .centrador {
+        width:700px;
+        margin:10px auto;
+        border:1px solid #ccc;
+        padding:20px;
+        background-color:#fff;
+    }
+    </style>
+</head>
+<body>
+    <div class="centrador">
+        <h1>Test languages module (Browser client side)</h1>
+        <hr />
+        <div id="test"></div>
+    </div> <!-- .centrador-->
+    <script>
+        var num_languages = 0,
+        text = '';
+
+        // languages.getAllLanguageCode() return an array of all ISO 639 language code supported
+        var langscodes = languages.getAllLanguageCode();
+        // iterate this array
+        for (num_languages=0; num_languages<langscodes.length; num_languages++) {
+            // save in text variable a string representation of the object return by languages.getLanguageInfo(langcode)
+            var langcode = langscodes[num_languages];
+            text+='<b>'+langcode+'</b> '+JSON.stringify(languages.getLanguageInfo(langcode))+'<br />';
+        }
+        // save the number of languages supported
+        text = '<h2>Languages supported: '+num_languages+'</h2>'+text;
+        // write the test result in DOM element with id='test'
+        document.getElementById('test').innerHTML = text;
+    </script>
+</body>
+</html>
+```
+
+Build
+-----
+
+To built a new version of languages4translatewiki, you need to install this node module:
+
+```sh
+npm install -g uglify-js
+```
+
+And then execute build/build.sh
diff --git a/build/build.sh b/build/build.sh
new file mode 100755
index 0000000..e248f3d
--- /dev/null
+++ b/build/build.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# This script need:
+#  npm install -g uglify-js
+# gzip, node and npm
+#
+# GPL 2012, Iván Eixarch
+GITLANGUAGES="https://github.com/joker-x/languages4translatewiki"
+set -e
+SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
+cd "$SCRIPTPATH"
+echo "Scraping translatewiki to languages.json..."
+JSON=$(node tw_api.js)
+HEADER=$(cat header.js)
+FOOTER=$(cat footer.js)
+cd ..
+echo -e "${JSON}" > languages.json
+echo "Building languages.js..."
+echo -e "${HEADER}\nvar langs = ${JSON}\n${FOOTER}" > languages.js 
+echo "Uglifying to languages.min.js"
+MINJS=$(uglifyjs languages.js)
+echo -e "/* From: ${GITLANGUAGES} */\n${MINJS}" > languages.min.js
+echo "Gziping..."
+gzip -9 -c languages.min.js > languages.min.js.gz
+gzip -9 -c languages.json > languages.json.gz
+touch languages.min.js languages.min.js.gz
+touch languages.json languages.json.gz
+read -p "Pulse ENTER to test it" KEY
+node test/node-example.js
+
diff --git a/build/build_scrap.sh b/build/build_scrap.sh
new file mode 100644
index 0000000..d4e15e8
--- /dev/null
+++ b/build/build_scrap.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# This script need:
+#  npm install jsdom
+#  npm install -g uglify-js
+# gzip, node and npm
+#
+# GPL 2012, Iván Eixarch
+GITLANGUAGES="https://github.com/joker-x/languages4translatewiki"
+set -e
+SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
+cd "$SCRIPTPATH"
+echo "Scraping translatewiki to languages.json..."
+JSON=$(node scrap.js)
+HEADER=$(cat header.js)
+FOOTER=$(cat footer.js)
+cd ..
+echo -e "${JSON}" > languages.json
+echo "Building languages.js..."
+echo -e "${HEADER}\nvar langs = ${JSON}\n${FOOTER}" > languages.js 
+echo "Uglifying to languages.min.js"
+MINJS=$(uglifyjs languages.js)
+echo -e "/* From: ${GITLANGUAGES} */\n${MINJS}" > languages.min.js
+echo "Gziping..."
+gzip -9 -c languages.min.js > languages.min.js.gz
+gzip -9 -c languages.json > languages.json.gz
+touch languages.min.js languages.min.js.gz
+touch languages.json languages.json.gz
+read -p "Pulse ENTER to test it" KEY
+node test/node-example.js
+
diff --git a/build/footer.js b/build/footer.js
new file mode 100644
index 0000000..d1a9690
--- /dev/null
+++ b/build/footer.js
@@ -0,0 +1,39 @@
+//return string "ltr" if the language is written from left to right or "rtl" in other case
+var getLangDirection = function(langcode) {
+  var result = "ltr";
+  if (langs.rtl.indexOf(langcode) != -1) result = "rtl";
+  return result;
+};
+
+/* PUBLIC */
+
+//return boolean value, true if langcode is supported
+exports.isValid = function(langcode) {
+  return langs.lang.hasOwnProperty(langcode);
+};
+
+//return array with all the language codes supported
+exports.getAllLanguageCode = function() {
+  var result = [];
+  for (langcode in langs.lang) {
+    result.push(langcode);
+  }
+  return result;
+};
+
+//return object {"nativeName", "direction"}
+//if langcode isn't supported return {}
+exports.getLanguageInfo = function(langcode) {
+  var result = {};
+  if (exports.isValid(langcode)) {
+    var lang = langs.lang[langcode];
+    for (attr in langs['attribute']) {
+      result[attr] = lang[langs['attribute'][attr]];
+    }
+    result['direction']=getLangDirection(langcode);
+  }
+  return result;
+};
+
+//allow executing by nodejs in the server or by javascript in the browser
+})(typeof exports === 'undefined'? this['languages']={}: exports);
diff --git a/build/header.js b/build/header.js
new file mode 100644
index 0000000..d772522
--- /dev/null
+++ b/build/header.js
@@ -0,0 +1,27 @@
+/*
+* Copyright 2012
+* Iván Eixarch <ivan at sinanimodelucro.org>
+* https://github.com/joker-x/languages4translatewiki
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA 02110-1301, USA.
+*/
+
+;(function(exports){
+
+/* PRIVATE */
+
+//embed object json
+//no accesible directly, you must use isValid, getAllLanguageCode or getLanguageInfo
diff --git a/build/scrap.js b/build/scrap.js
new file mode 100644
index 0000000..159b4d7
--- /dev/null
+++ b/build/scrap.js
@@ -0,0 +1,58 @@
+/*
+* Scrap all languages supported by translatewiki
+* Depends of jsdom
+* Use: node scrap.js > languages.json
+*/
+
+/*
+* Copyright 2012
+* Iván Eixarch <ivan at sinanimodelucro.org>
+* https://github.com/joker-x/languages4translatewiki
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA 02110-1301, USA.
+*/
+
+/* CONFIGURATION */
+var target = 'http://translatewiki.net/wiki/Special:SupportedLanguages';
+var debug = false;
+
+/* PROGRAM */
+var jsdom = require('jsdom');
+
+jsdom.env(target, ['//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'],
+function(errors, window) {
+
+  var decodeHTML = function(text) {
+    return $('<div />').html($.trim(text)).text();
+  }
+
+  var json = '{'+"\n"+'"attribute":{"name":0,"nativeName":1},'+"\n"+'"rtl":["ar","dv","fa","ha","he","ks","ku","ps","ur","yi"],'+"\n"+'"lang":{'+"\n"
+    , $ = window.$
+    , num_langs = 0;
+
+  $('h2').each(function() {
+    var langcode = $(this).attr('id')
+      , texto = $(this).text().split(']')[1].split('-')
+      , name = decodeHTML(texto[0])
+      , nativeName = decodeHTML(texto[1]);
+    json += '"'+langcode+'":["'+name+'","'+nativeName+'"],'+"\n";
+    num_langs++;
+  });
+  json += '}'+"\n"+
+    '}';
+  console.log(json);
+  if (debug) console.log(num_langs);
+});
diff --git a/build/tw_api.js b/build/tw_api.js
new file mode 100644
index 0000000..e1e9732
--- /dev/null
+++ b/build/tw_api.js
@@ -0,0 +1,59 @@
+/*
+* Query all languages supported by translatewiki by API
+* Use: node tw_api.js > languages.json
+*/
+
+/*
+* Copyright 2012
+* Iván Eixarch <ivan at sinanimodelucro.org>
+* https://github.com/joker-x/languages4translatewiki
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA 02110-1301, USA.
+*/
+
+/* CONFIGURATION */
+var target = 'http://translatewiki.net/w/api.php?action=query&meta=siteinfo&siprop=languages&format=json';
+
+/* PROGRAM */
+var http = require ('http');
+
+var json = '{'+"\n"+'"attribute":{"nativeName":0},'+"\n"+'"rtl":["ar","dv","fa","ha","he","ks","ku","ps","ur","yi"],'+"\n"+'"lang":{'+"\n"
+
+// build json with translatewiki web API
+var request = http.request (target,
+  function (res) {
+    var twLangs = ''
+      , num_langs = 0;
+    res.setEncoding ('utf8');
+    res.on ('data', function (chunk) { twLangs += chunk; });
+    res.on ('end', function () {
+      // twLangs = [{code: 'en', '*': 'English'}...]
+      twLangs = JSON.parse(twLangs)['query']['languages'];
+
+      for (var l = 0; l < twLangs.length; l++) {
+        var code = twLangs[l]['code']
+          , nativeName = twLangs[l]['*'];
+        json += '"'+code+'":["'+nativeName+'"]';
+        if (l < (twLangs.length-1)) json += ",\n";
+      }
+
+      json += '}'+"\n"+
+      '}';
+      console.log(json);
+    });
+  }).on ('error', function(e) {
+    console.error('While query translatewiki API: '+e.message);
+  }).end();
diff --git a/languages.js b/languages.js
new file mode 100644
index 0000000..7c199e0
--- /dev/null
+++ b/languages.js
@@ -0,0 +1,539 @@
+/*
+* Copyright 2012
+* Iván Eixarch <ivan at sinanimodelucro.org>
+* https://github.com/joker-x/languages4translatewiki
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA 02110-1301, USA.
+*/
+
+;(function(exports){
+
+/* PRIVATE */
+
+//embed object json
+//no accesible directly, you must use isValid, getAllLanguageCode or getLanguageInfo
+var langs = {
+"attribute":{"nativeName":0},
+"rtl":["ar","dv","fa","ha","he","ks","ku","ps","ur","yi"],
+"lang":{
+"sxu":["Säggssch"],
+"rtm":["Faeag Rotuma"],
+"wls":["Faka'uvea"],
+"twd":["Tweants"],
+"trp":["Kokborok (Tripuri)"],
+"pko":["Pökoot"],
+"pru":["Prūsiskan"],
+"test":["Test (site admin only)"],
+"swb":["Shikomoro"],
+"njo":["Ao"],
+"mni":["মেইতেই লোন্"],
+"ttt":["Tati"],
+"yrl":["ñe'engatú"],
+"krl":["Karjala"],
+"mwv":["Behase Mentawei"],
+"niu":["ko e vagahau Niuē"],
+"bew":["Bahasa Betawi"],
+"rw":["Kinyarwanda"],
+"slr":["Salırça"],
+"ryu":["ʔucināguci"],
+"gom":["कोंकणी/Konknni "],
+"gom-deva":["कोंकणी"],
+"gom-latn":["Konknni"],
+"akz":["Albaamo innaaɬiilka"],
+"kgp":["Kaingáng"],
+"hu-formal":["Magyar (magázó)"],
+"kea":["Kabuverdianu"],
+"ady":["Адыгэбзэ / Adygabze"],
+"ady-cyrl":["Адыгэбзэ"],
+"tsd":["Τσακωνικά"],
+"arq":["Dziri"],
+"gcf":["Guadeloupean Creole French"],
+"lld":["Ladin"],
+"ruq-grek":["Megleno-Romanian (Greek script)"],
+"ydd":["Eastern Yiddish"],
+"tzm":["ⵜⴰⵎⴰⵣⵉⵖⵜ"],
+"bto":["Iriga Bicolano"],
+"rap":["arero rapa nui"],
+"bfq":["படகா"],
+"guc":["Wayúu"],
+"mui":["Musi"],
+"kbd-latn":["Qabardjajəbza"],
+"ase":["American sign language"],
+"es-419":["español de America Latina"],
+"mnc":["ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ"],
+"aro":["Araona"],
+"hif-deva":["फ़ीजी हिन्दी"],
+"gah":["Alekano"],
+"rki":["ရခိုင်"],
+"es-formal":["español (formal)"],
+"nqo":["ߒߞߏ"],
+"gbz":["Dari"],
+"gur":["Gurenɛ"],
+"yrk":["Ненэцяʼ вада"],
+"esu":["Yup'ik"],
+"saz":["ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ"],
+"hsn":["湘语"],
+"yua":["Maaya T'aan"],
+"tkr":["ЦӀаьхна миз"],
+"aeb":["   زَوُن"],
+"pis":["Pijin"],
+"ppl":["Nawat"],
+"shn":["လိၵ်ႈတႆး"],
+"bbc":["Batak Toba/Batak autonym unknown"],
+"bbc-latn":["Batak Toba"],
+"mfe":["Morisyen"],
+"ksf":["Bafia"],
+"hne":["छत्तीसगढ़ी"],
+"sly":["Bahasa Selayar"],
+"ahr":["अहिराणी"],
+"mic":["Mi'kmaq"],
+"mnw":["ဘာသာ မန်"],
+"rut":["мыхIабишды чIел"],
+"acf":["Saint Lucian Creole French"],
+"azb":["تورکجه"],
+"izh":["ižoran keel"],
+"ban":["ᬩᬲᬩᬮᬶ"],
+"nl-be":["nl-be"],
+"qqq":["Message documentation"],
+"ike":["ᐃᓄᒃᑎᑐᑦ/inuktitut"],
+"aa":["Qafár af"],
+"ab":["Аҧсшәа"],
+"ace":["Acèh"],
+"af":["Afrikaans"],
+"ak":["Akan"],
+"aln":["Gegë"],
+"als":["Tosk"],
+"am":["አማርኛ"],
+"an":["aragonés"],
+"ang":["Ænglisc"],
+"anp":["अङ्गिका"],
+"ar":["العربية"],
+"arc":["ܐܪܡܝܐ"],
+"arn":["mapudungun"],
+"ary":["Maġribi"],
+"arz":["مصرى"],
+"as":["অসমীয়া"],
+"ast":["asturianu"],
+"av":["авар"],
+"avk":["Kotava"],
+"ay":["Aymar aru"],
+"az":["azərbaycanca"],
+"ba":["башҡортса"],
+"bar":["Boarisch"],
+"bat-smg":["žemaitėška"],
+"bcc":["بلوچی مکرانی"],
+"bcl":["Bikol Central"],
+"be":["беларуская"],
+"be-tarask":["беларуская (тарашкевіца)‎"],
+"be-x-old":["беларуская (тарашкевіца)‎"],
+"bg":["български"],
+"bh":["भोजपुरी"],
+"bho":["भोजपुरी"],
+"bi":["Bislama"],
+"bjn":["Bahasa Banjar"],
+"bm":["bamanankan"],
+"bn":["বাংলা"],
+"bo":["བོད་ཡིག"],
+"bpy":["বিষ্ণুপ্রিয়া মণিপুরী"],
+"bqi":["بختياري"],
+"br":["brezhoneg"],
+"brh":["Bráhuí"],
+"bs":["bosanski"],
+"bug":["ᨅᨔ ᨕᨘᨁᨗ"],
+"bxr":["буряад"],
+"ca":["català"],
+"cbk-zam":["Chavacano de Zamboanga"],
+"cdo":["Mìng-dĕ̤ng-ngṳ̄"],
+"ce":["нохчийн"],
+"ceb":["Cebuano"],
+"ch":["Chamoru"],
+"cho":["Choctaw"],
+"chr":["ᏣᎳᎩ"],
+"chy":["Tsetsêhestâhese"],
+"ckb":["کوردی"],
+"co":["corsu"],
+"cps":["Capiceño"],
+"cr":["Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ"],
+"crh":["qırımtatarca"],
+"crh-latn":["qırımtatarca (Latin)‎"],
+"crh-cyrl":["къырымтатарджа (Кирилл)‎"],
+"cs":["česky"],
+"csb":["kaszëbsczi"],
+"cu":["словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ"],
+"cv":["Чӑвашла"],
+"cy":["Cymraeg"],
+"da":["dansk"],
+"de":["Deutsch"],
+"de-at":["Österreichisches Deutsch"],
+"de-ch":["Schweizer Hochdeutsch"],
+"de-formal":["Deutsch (Sie-Form)‎"],
+"diq":["Zazaki"],
+"dsb":["dolnoserbski"],
+"dtp":["Dusun Bundu-liwan"],
+"dv":["ދިވެހިބަސް"],
+"dz":["ཇོང་ཁ"],
+"ee":["eʋegbe"],
+"egl":["Emiliàn"],
+"el":["Ελληνικά"],
+"eml":["emiliàn e rumagnòl"],
+"en":["English"],
+"en-ca":["Canadian English"],
+"en-gb":["British English"],
+"eo":["Esperanto"],
+"es":["español"],
+"et":["eesti"],
+"eu":["euskara"],
+"ext":["estremeñu"],
+"fa":["فارسی"],
+"ff":["Fulfulde"],
+"fi":["suomi"],
+"fit":["meänkieli"],
+"fiu-vro":["Võro"],
+"fj":["Na Vosa Vakaviti"],
+"fo":["føroyskt"],
+"fr":["français"],
+"frc":["français cadien"],
+"frp":["arpetan"],
+"frr":["Nordfriisk"],
+"fur":["furlan"],
+"fy":["Frysk"],
+"ga":["Gaeilge"],
+"gag":["Gagauz"],
+"gan":["贛語"],
+"gan-hans":["赣语(简体)‎"],
+"gan-hant":["贛語(繁體)‎"],
+"gd":["Gàidhlig"],
+"gl":["galego"],
+"glk":["گیلکی"],
+"gn":["Avañe'ẽ"],
+"got":["Gothic"],
+"grc":["Ἀρχαία ἑλληνικὴ"],
+"gsw":["Alemannisch"],
+"gu":["ગુજરાતી"],
+"gv":["Gaelg"],
+"ha":["Hausa"],
+"hak":["Hak-kâ-fa"],
+"haw":["Hawai`i"],
+"he":["עברית"],
+"hi":["हिन्दी"],
+"hif":["Fiji Hindi"],
+"hif-latn":["Fiji Hindi"],
+"hil":["Ilonggo"],
+"ho":["Hiri Motu"],
+"hr":["hrvatski"],
+"hsb":["hornjoserbsce"],
+"ht":["Kreyòl ayisyen"],
+"hu":["magyar"],
+"hy":["Հայերեն"],
+"hz":["Otsiherero"],
+"ia":["interlingua"],
+"id":["Bahasa Indonesia"],
+"ie":["Interlingue"],
+"ig":["Igbo"],
+"ii":["ꆇꉙ"],
+"ik":["Iñupiak"],
+"ike-cans":["ᐃᓄᒃᑎᑐᑦ"],
+"ike-latn":["inuktitut"],
+"ilo":["Ilokano"],
+"inh":["ГӀалгӀай"],
+"io":["Ido"],
+"is":["íslenska"],
+"it":["italiano"],
+"iu":["ᐃᓄᒃᑎᑐᑦ/inuktitut"],
+"ja":["日本語"],
+"jam":["Patois"],
+"jbo":["Lojban"],
+"jut":["jysk"],
+"jv":["Basa Jawa"],
+"ka":["ქართული"],
+"kaa":["Qaraqalpaqsha"],
+"kab":["Taqbaylit"],
+"kbd":["Адыгэбзэ"],
+"kbd-cyrl":["Адыгэбзэ"],
+"kg":["Kongo"],
+"khw":["کھوار"],
+"ki":["Gĩkũyũ"],
+"kiu":["Kırmancki"],
+"kj":["Kwanyama"],
+"kk":["қазақша"],
+"kk-arab":["قازاقشا (تٴوتە)‏"],
+"kk-cyrl":["қазақша (кирил)‎"],
+"kk-latn":["qazaqşa (latın)‎"],
+"kk-cn":["قازاقشا (جۇنگو)‏"],
+"kk-kz":["қазақша (Қазақстан)‎"],
+"kk-tr":["qazaqşa (Türkïya)‎"],
+"kl":["kalaallisut"],
+"km":["ភាសាខ្មែរ"],
+"kn":["ಕನ್ನಡ"],
+"ko":["한국어"],
+"ko-kp":["한국어 (조선)"],
+"koi":["Перем Коми"],
+"kr":["Kanuri"],
+"krc":["къарачай-малкъар"],
+"kri":["Krio"],
+"krj":["Kinaray-a"],
+"ks":["कॉशुर / کٲشُر"],
+"ks-arab":["کٲشُر"],
+"ks-deva":["कॉशुर"],
+"ksh":["Ripoarisch"],
+"ku":["Kurdî"],
+"ku-latn":["Kurdî (latînî)‎"],
+"ku-arab":["كوردي (عەرەبی)‏"],
+"kv":["коми"],
+"kw":["kernowek"],
+"ky":["Кыргызча"],
+"la":["Latina"],
+"lad":["Ladino"],
+"lb":["Lëtzebuergesch"],
+"lbe":["лакку"],
+"lez":["лезги"],
+"lfn":["Lingua Franca Nova"],
+"lg":["Luganda"],
+"li":["Limburgs"],
+"lij":["Ligure"],
+"liv":["Līvõ kēļ"],
+"lmo":["lumbaart"],
+"ln":["lingála"],
+"lo":["ລາວ"],
+"loz":["Silozi"],
+"lt":["lietuvių"],
+"ltg":["latgaļu"],
+"lus":["Mizo ţawng"],
+"lv":["latviešu"],
+"lzh":["文言"],
+"lzz":["Lazuri"],
+"mai":["मैथिली"],
+"map-bms":["Basa Banyumasan"],
+"mdf":["мокшень"],
+"mg":["Malagasy"],
+"mh":["Ebon"],
+"mhr":["олык марий"],
+"mi":["Māori"],
+"min":["Baso Minangkabau"],
+"mk":["македонски"],
+"ml":["മലയാളം"],
+"mn":["монгол"],
+"mo":["молдовеняскэ"],
+"mr":["मराठी"],
+"mrj":["кырык мары"],
+"ms":["Bahasa Melayu"],
+"mt":["Malti"],
+"mus":["Mvskoke"],
+"mwl":["Mirandés"],
+"my":["မြန်မာဘာသာ"],
+"myv":["эрзянь"],
+"mzn":["مازِرونی"],
+"na":["Dorerin Naoero"],
+"nah":["Nāhuatl"],
+"nan":["Bân-lâm-gú"],
+"nap":["Nnapulitano"],
+"nb":["norsk (bokmål)‎"],
+"nds":["Plattdüütsch"],
+"nds-nl":["Nedersaksies"],
+"ne":["नेपाली"],
+"new":["नेपाल भाषा"],
+"ng":["Oshiwambo"],
+"nl":["Nederlands"],
+"nl-informal":["Nederlands (informeel)‎"],
+"nn":["norsk (nynorsk)‎"],
+"no":["norsk (bokmål)‎"],
+"nov":["Novial"],
+"nrm":["Nouormand"],
+"nso":["Sesotho sa Leboa"],
+"nv":["Diné bizaad"],
+"ny":["Chi-Chewa"],
+"oc":["occitan"],
+"om":["Oromoo"],
+"or":["ଓଡ଼ିଆ"],
+"os":["Ирон"],
+"pa":["ਪੰਜਾਬੀ"],
+"pag":["Pangasinan"],
+"pam":["Kapampangan"],
+"pap":["Papiamentu"],
+"pcd":["Picard"],
+"pdc":["Deitsch"],
+"pdt":["Plautdietsch"],
+"pfl":["Pälzisch"],
+"pi":["पाळि"],
+"pih":["Norfuk / Pitkern"],
+"pl":["polski"],
+"pms":["Piemontèis"],
+"pnb":["پنجابی"],
+"pnt":["Ποντιακά"],
+"prg":["Prūsiskan"],
+"ps":["پښتو"],
+"pt":["português"],
+"pt-br":["português do Brasil"],
+"qu":["Runa Simi"],
+"qug":["Runa shimi"],
+"rgn":["Rumagnôl"],
+"rif":["Tarifit"],
+"rm":["rumantsch"],
+"rmy":["Romani"],
+"rn":["Kirundi"],
+"ro":["română"],
+"roa-rup":["Armãneashce"],
+"roa-tara":["tarandíne"],
+"ru":["русский"],
+"rue":["русиньскый"],
+"rup":["Armãneashce"],
+"ruq":["Vlăheşte"],
+"ruq-cyrl":["Влахесте"],
+"ruq-latn":["Vlăheşte"],
+"sa":["संस्कृतम्"],
+"sah":["саха тыла"],
+"sat":["Santali"],
+"sc":["sardu"],
+"scn":["sicilianu"],
+"sco":["Scots"],
+"sd":["سنڌي"],
+"sdc":["Sassaresu"],
+"se":["sámegiella"],
+"sei":["Cmique Itom"],
+"sg":["Sängö"],
+"sgs":["žemaitėška"],
+"sh":["srpskohrvatski / српскохрватски"],
+"shi":["Tašlḥiyt/ⵜⴰⵛⵍⵃⵉⵜ"],
+"shi-tfng":["ⵜⴰⵛⵍⵃⵉⵜ"],
+"shi-latn":["Tašlḥiyt"],
+"si":["සිංහල"],
+"simple":["Simple English"],
+"sk":["slovenčina"],
+"sl":["slovenščina"],
+"sli":["Schläsch"],
+"sm":["Gagana Samoa"],
+"sma":["Åarjelsaemien"],
+"sn":["chiShona"],
+"so":["Soomaaliga"],
+"sq":["shqip"],
+"sr":["српски / srpski"],
+"sr-ec":["српски (ћирилица)‎"],
+"sr-el":["srpski (latinica)‎"],
+"srn":["Sranantongo"],
+"ss":["SiSwati"],
+"st":["Sesotho"],
+"stq":["Seeltersk"],
+"su":["Basa Sunda"],
+"sv":["svenska"],
+"sw":["Kiswahili"],
+"szl":["ślůnski"],
+"ta":["தமிழ்"],
+"tcy":["ತುಳು"],
+"te":["తెలుగు"],
+"tet":["tetun"],
+"tg":["тоҷикӣ"],
+"tg-cyrl":["тоҷикӣ"],
+"tg-latn":["tojikī"],
+"th":["ไทย"],
+"ti":["ትግርኛ"],
+"tk":["Türkmençe"],
+"tl":["Tagalog"],
+"tly":["толышә зывон"],
+"tn":["Setswana"],
+"to":["lea faka-Tonga"],
+"tokipona":["Toki Pona"],
+"tpi":["Tok Pisin"],
+"tr":["Türkçe"],
+"tru":["Ṫuroyo"],
+"ts":["Xitsonga"],
+"tt":["татарча/tatarça"],
+"tt-cyrl":["татарча"],
+"tt-latn":["tatarça"],
+"tum":["chiTumbuka"],
+"tw":["Twi"],
+"ty":["Reo Mā`ohi"],
+"tyv":["тыва дыл"],
+"udm":["удмурт"],
+"ug":["ئۇيغۇرچە / Uyghurche"],
+"ug-arab":["ئۇيغۇرچە"],
+"ug-latn":["Uyghurche"],
+"uk":["українська"],
+"ur":["اردو"],
+"uz":["oʻzbekcha"],
+"ve":["Tshivenda"],
+"vec":["vèneto"],
+"vep":["vepsän kel’"],
+"vi":["Tiếng Việt"],
+"vls":["West-Vlams"],
+"vmf":["Mainfränkisch"],
+"vo":["Volapük"],
+"vot":["Vaďďa"],
+"vro":["Võro"],
+"wa":["walon"],
+"war":["Winaray"],
+"wo":["Wolof"],
+"wuu":["吴语"],
+"xal":["хальмг"],
+"xh":["isiXhosa"],
+"xmf":["მარგალური"],
+"yi":["ייִדיש"],
+"yo":["Yorùbá"],
+"yue":["粵語"],
+"za":["Vahcuengh"],
+"zea":["Zeêuws"],
+"zh":["中文"],
+"zh-classical":["文言"],
+"zh-cn":["中文(中国大陆)‎"],
+"zh-hans":["中文(简体)‎"],
+"zh-hant":["中文(繁體)‎"],
+"zh-hk":["中文(香港)‎"],
+"zh-min-nan":["Bân-lâm-gú"],
+"zh-mo":["中文(澳門)‎"],
+"zh-my":["中文(马来西亚)‎"],
+"zh-sg":["中文(新加坡)‎"],
+"zh-tw":["中文(台灣)‎"],
+"zh-yue":["粵語"],
+"zu":["isiZulu"]}
+}
+//return string "ltr" if the language is written from left to right or "rtl" in other case
+var getLangDirection = function(langcode) {
+  var result = "ltr";
+  if (langs.rtl.indexOf(langcode) != -1) result = "rtl";
+  return result;
+};
+
+/* PUBLIC */
+
+//return boolean value, true if langcode is supported
+exports.isValid = function(langcode) {
+  return langs.lang.hasOwnProperty(langcode);
+};
+
+//return array with all the language codes supported
+exports.getAllLanguageCode = function() {
+  var result = [];
+  for (langcode in langs.lang) {
+    result.push(langcode);
+  }
+  return result;
+};
+
+//return object {"nativeName", "direction"}
+//if langcode isn't supported return {}
+exports.getLanguageInfo = function(langcode) {
+  var result = {};
+  if (exports.isValid(langcode)) {
+    var lang = langs.lang[langcode];
+    for (attr in langs['attribute']) {
+      result[attr] = lang[langs['attribute'][attr]];
+    }
+    result['direction']=getLangDirection(langcode);
+  }
+  return result;
+};
+
+//allow executing by nodejs in the server or by javascript in the browser
+})(typeof exports === 'undefined'? this['languages']={}: exports);
diff --git a/languages.json b/languages.json
new file mode 100644
index 0000000..a7e60e7
--- /dev/null
+++ b/languages.json
@@ -0,0 +1,473 @@
+{
+"attribute":{"nativeName":0},
+"rtl":["ar","dv","fa","ha","he","ks","ku","ps","ur","yi"],
+"lang":{
+"sxu":["Säggssch"],
+"rtm":["Faeag Rotuma"],
+"wls":["Faka'uvea"],
+"twd":["Tweants"],
+"trp":["Kokborok (Tripuri)"],
+"pko":["Pökoot"],
+"pru":["Prūsiskan"],
+"test":["Test (site admin only)"],
+"swb":["Shikomoro"],
+"njo":["Ao"],
+"mni":["মেইতেই লোন্"],
+"ttt":["Tati"],
+"yrl":["ñe'engatú"],
+"krl":["Karjala"],
+"mwv":["Behase Mentawei"],
+"niu":["ko e vagahau Niuē"],
+"bew":["Bahasa Betawi"],
+"rw":["Kinyarwanda"],
+"slr":["Salırça"],
+"ryu":["ʔucināguci"],
+"gom":["कोंकणी/Konknni "],
+"gom-deva":["कोंकणी"],
+"gom-latn":["Konknni"],
+"akz":["Albaamo innaaɬiilka"],
+"kgp":["Kaingáng"],
+"hu-formal":["Magyar (magázó)"],
+"kea":["Kabuverdianu"],
+"ady":["Адыгэбзэ / Adygabze"],
+"ady-cyrl":["Адыгэбзэ"],
+"tsd":["Τσακωνικά"],
+"arq":["Dziri"],
+"gcf":["Guadeloupean Creole French"],
+"lld":["Ladin"],
+"ruq-grek":["Megleno-Romanian (Greek script)"],
+"ydd":["Eastern Yiddish"],
+"tzm":["ⵜⴰⵎⴰⵣⵉⵖⵜ"],
+"bto":["Iriga Bicolano"],
+"rap":["arero rapa nui"],
+"bfq":["படகா"],
+"guc":["Wayúu"],
+"mui":["Musi"],
+"kbd-latn":["Qabardjajəbza"],
+"ase":["American sign language"],
+"es-419":["español de America Latina"],
+"mnc":["ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ"],
+"aro":["Araona"],
+"hif-deva":["फ़ीजी हिन्दी"],
+"gah":["Alekano"],
+"rki":["ရခိုင်"],
+"es-formal":["español (formal)"],
+"nqo":["ߒߞߏ"],
+"gbz":["Dari"],
+"gur":["Gurenɛ"],
+"yrk":["Ненэцяʼ вада"],
+"esu":["Yup'ik"],
+"saz":["ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ"],
+"hsn":["湘语"],
+"yua":["Maaya T'aan"],
+"tkr":["ЦӀаьхна миз"],
+"aeb":["   زَوُن"],
+"pis":["Pijin"],
+"ppl":["Nawat"],
+"shn":["လိၵ်ႈတႆး"],
+"bbc":["Batak Toba/Batak autonym unknown"],
+"bbc-latn":["Batak Toba"],
+"mfe":["Morisyen"],
+"ksf":["Bafia"],
+"hne":["छत्तीसगढ़ी"],
+"sly":["Bahasa Selayar"],
+"ahr":["अहिराणी"],
+"mic":["Mi'kmaq"],
+"mnw":["ဘာသာ မန်"],
+"rut":["мыхIабишды чIел"],
+"acf":["Saint Lucian Creole French"],
+"azb":["تورکجه"],
+"izh":["ižoran keel"],
+"ban":["ᬩᬲᬩᬮᬶ"],
+"nl-be":["nl-be"],
+"qqq":["Message documentation"],
+"ike":["ᐃᓄᒃᑎᑐᑦ/inuktitut"],
+"aa":["Qafár af"],
+"ab":["Аҧсшәа"],
+"ace":["Acèh"],
+"af":["Afrikaans"],
+"ak":["Akan"],
+"aln":["Gegë"],
+"als":["Tosk"],
+"am":["አማርኛ"],
+"an":["aragonés"],
+"ang":["Ænglisc"],
+"anp":["अङ्गिका"],
+"ar":["العربية"],
+"arc":["ܐܪܡܝܐ"],
+"arn":["mapudungun"],
+"ary":["Maġribi"],
+"arz":["مصرى"],
+"as":["অসমীয়া"],
+"ast":["asturianu"],
+"av":["авар"],
+"avk":["Kotava"],
+"ay":["Aymar aru"],
+"az":["azərbaycanca"],
+"ba":["башҡортса"],
+"bar":["Boarisch"],
+"bat-smg":["žemaitėška"],
+"bcc":["بلوچی مکرانی"],
+"bcl":["Bikol Central"],
+"be":["беларуская"],
+"be-tarask":["беларуская (тарашкевіца)‎"],
+"be-x-old":["беларуская (тарашкевіца)‎"],
+"bg":["български"],
+"bh":["भोजपुरी"],
+"bho":["भोजपुरी"],
+"bi":["Bislama"],
+"bjn":["Bahasa Banjar"],
+"bm":["bamanankan"],
+"bn":["বাংলা"],
+"bo":["བོད་ཡིག"],
+"bpy":["বিষ্ণুপ্রিয়া মণিপুরী"],
+"bqi":["بختياري"],
+"br":["brezhoneg"],
+"brh":["Bráhuí"],
+"bs":["bosanski"],
+"bug":["ᨅᨔ ᨕᨘᨁᨗ"],
+"bxr":["буряад"],
+"ca":["català"],
+"cbk-zam":["Chavacano de Zamboanga"],
+"cdo":["Mìng-dĕ̤ng-ngṳ̄"],
+"ce":["нохчийн"],
+"ceb":["Cebuano"],
+"ch":["Chamoru"],
+"cho":["Choctaw"],
+"chr":["ᏣᎳᎩ"],
+"chy":["Tsetsêhestâhese"],
+"ckb":["کوردی"],
+"co":["corsu"],
+"cps":["Capiceño"],
+"cr":["Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ"],
+"crh":["qırımtatarca"],
+"crh-latn":["qırımtatarca (Latin)‎"],
+"crh-cyrl":["къырымтатарджа (Кирилл)‎"],
+"cs":["česky"],
+"csb":["kaszëbsczi"],
+"cu":["словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ"],
+"cv":["Чӑвашла"],
+"cy":["Cymraeg"],
+"da":["dansk"],
+"de":["Deutsch"],
+"de-at":["Österreichisches Deutsch"],
+"de-ch":["Schweizer Hochdeutsch"],
+"de-formal":["Deutsch (Sie-Form)‎"],
+"diq":["Zazaki"],
+"dsb":["dolnoserbski"],
+"dtp":["Dusun Bundu-liwan"],
+"dv":["ދިވެހިބަސް"],
+"dz":["ཇོང་ཁ"],
+"ee":["eʋegbe"],
+"egl":["Emiliàn"],
+"el":["Ελληνικά"],
+"eml":["emiliàn e rumagnòl"],
+"en":["English"],
+"en-ca":["Canadian English"],
+"en-gb":["British English"],
+"eo":["Esperanto"],
+"es":["español"],
+"et":["eesti"],
+"eu":["euskara"],
+"ext":["estremeñu"],
+"fa":["فارسی"],
+"ff":["Fulfulde"],
+"fi":["suomi"],
+"fit":["meänkieli"],
+"fiu-vro":["Võro"],
+"fj":["Na Vosa Vakaviti"],
+"fo":["føroyskt"],
+"fr":["français"],
+"frc":["français cadien"],
+"frp":["arpetan"],
+"frr":["Nordfriisk"],
+"fur":["furlan"],
+"fy":["Frysk"],
+"ga":["Gaeilge"],
+"gag":["Gagauz"],
+"gan":["贛語"],
+"gan-hans":["赣语(简体)‎"],
+"gan-hant":["贛語(繁體)‎"],
+"gd":["Gàidhlig"],
+"gl":["galego"],
+"glk":["گیلکی"],
+"gn":["Avañe'ẽ"],
+"got":["Gothic"],
+"grc":["Ἀρχαία ἑλληνικὴ"],
+"gsw":["Alemannisch"],
+"gu":["ગુજરાતી"],
+"gv":["Gaelg"],
+"ha":["Hausa"],
+"hak":["Hak-kâ-fa"],
+"haw":["Hawai`i"],
+"he":["עברית"],
+"hi":["हिन्दी"],
+"hif":["Fiji Hindi"],
+"hif-latn":["Fiji Hindi"],
+"hil":["Ilonggo"],
+"ho":["Hiri Motu"],
+"hr":["hrvatski"],
+"hsb":["hornjoserbsce"],
+"ht":["Kreyòl ayisyen"],
+"hu":["magyar"],
+"hy":["Հայերեն"],
+"hz":["Otsiherero"],
+"ia":["interlingua"],
+"id":["Bahasa Indonesia"],
+"ie":["Interlingue"],
+"ig":["Igbo"],
+"ii":["ꆇꉙ"],
+"ik":["Iñupiak"],
+"ike-cans":["ᐃᓄᒃᑎᑐᑦ"],
+"ike-latn":["inuktitut"],
+"ilo":["Ilokano"],
+"inh":["ГӀалгӀай"],
+"io":["Ido"],
+"is":["íslenska"],
+"it":["italiano"],
+"iu":["ᐃᓄᒃᑎᑐᑦ/inuktitut"],
+"ja":["日本語"],
+"jam":["Patois"],
+"jbo":["Lojban"],
+"jut":["jysk"],
+"jv":["Basa Jawa"],
+"ka":["ქართული"],
+"kaa":["Qaraqalpaqsha"],
+"kab":["Taqbaylit"],
+"kbd":["Адыгэбзэ"],
+"kbd-cyrl":["Адыгэбзэ"],
+"kg":["Kongo"],
+"khw":["کھوار"],
+"ki":["Gĩkũyũ"],
+"kiu":["Kırmancki"],
+"kj":["Kwanyama"],
+"kk":["қазақша"],
+"kk-arab":["قازاقشا (تٴوتە)‏"],
+"kk-cyrl":["қазақша (кирил)‎"],
+"kk-latn":["qazaqşa (latın)‎"],
+"kk-cn":["قازاقشا (جۇنگو)‏"],
+"kk-kz":["қазақша (Қазақстан)‎"],
+"kk-tr":["qazaqşa (Türkïya)‎"],
+"kl":["kalaallisut"],
+"km":["ភាសាខ្មែរ"],
+"kn":["ಕನ್ನಡ"],
+"ko":["한국어"],
+"ko-kp":["한국어 (조선)"],
+"koi":["Перем Коми"],
+"kr":["Kanuri"],
+"krc":["къарачай-малкъар"],
+"kri":["Krio"],
+"krj":["Kinaray-a"],
+"ks":["कॉशुर / کٲشُر"],
+"ks-arab":["کٲشُر"],
+"ks-deva":["कॉशुर"],
+"ksh":["Ripoarisch"],
+"ku":["Kurdî"],
+"ku-latn":["Kurdî (latînî)‎"],
+"ku-arab":["كوردي (عەرەبی)‏"],
+"kv":["коми"],
+"kw":["kernowek"],
+"ky":["Кыргызча"],
+"la":["Latina"],
+"lad":["Ladino"],
+"lb":["Lëtzebuergesch"],
+"lbe":["лакку"],
+"lez":["лезги"],
+"lfn":["Lingua Franca Nova"],
+"lg":["Luganda"],
+"li":["Limburgs"],
+"lij":["Ligure"],
+"liv":["Līvõ kēļ"],
+"lmo":["lumbaart"],
+"ln":["lingála"],
+"lo":["ລາວ"],
+"loz":["Silozi"],
+"lt":["lietuvių"],
+"ltg":["latgaļu"],
+"lus":["Mizo ţawng"],
+"lv":["latviešu"],
+"lzh":["文言"],
+"lzz":["Lazuri"],
+"mai":["मैथिली"],
+"map-bms":["Basa Banyumasan"],
+"mdf":["мокшень"],
+"mg":["Malagasy"],
+"mh":["Ebon"],
+"mhr":["олык марий"],
+"mi":["Māori"],
+"min":["Baso Minangkabau"],
+"mk":["македонски"],
+"ml":["മലയാളം"],
+"mn":["монгол"],
+"mo":["молдовеняскэ"],
+"mr":["मराठी"],
+"mrj":["кырык мары"],
+"ms":["Bahasa Melayu"],
+"mt":["Malti"],
+"mus":["Mvskoke"],
+"mwl":["Mirandés"],
+"my":["မြန်မာဘာသာ"],
+"myv":["эрзянь"],
+"mzn":["مازِرونی"],
+"na":["Dorerin Naoero"],
+"nah":["Nāhuatl"],
+"nan":["Bân-lâm-gú"],
+"nap":["Nnapulitano"],
+"nb":["norsk (bokmål)‎"],
+"nds":["Plattdüütsch"],
+"nds-nl":["Nedersaksies"],
+"ne":["नेपाली"],
+"new":["नेपाल भाषा"],
+"ng":["Oshiwambo"],
+"nl":["Nederlands"],
+"nl-informal":["Nederlands (informeel)‎"],
+"nn":["norsk (nynorsk)‎"],
+"no":["norsk (bokmål)‎"],
+"nov":["Novial"],
+"nrm":["Nouormand"],
+"nso":["Sesotho sa Leboa"],
+"nv":["Diné bizaad"],
+"ny":["Chi-Chewa"],
+"oc":["occitan"],
+"om":["Oromoo"],
+"or":["ଓଡ଼ିଆ"],
+"os":["Ирон"],
+"pa":["ਪੰਜਾਬੀ"],
+"pag":["Pangasinan"],
+"pam":["Kapampangan"],
+"pap":["Papiamentu"],
+"pcd":["Picard"],
+"pdc":["Deitsch"],
+"pdt":["Plautdietsch"],
+"pfl":["Pälzisch"],
+"pi":["पाळि"],
+"pih":["Norfuk / Pitkern"],
+"pl":["polski"],
+"pms":["Piemontèis"],
+"pnb":["پنجابی"],
+"pnt":["Ποντιακά"],
+"prg":["Prūsiskan"],
+"ps":["پښتو"],
+"pt":["português"],
+"pt-br":["português do Brasil"],
+"qu":["Runa Simi"],
+"qug":["Runa shimi"],
+"rgn":["Rumagnôl"],
+"rif":["Tarifit"],
+"rm":["rumantsch"],
+"rmy":["Romani"],
+"rn":["Kirundi"],
+"ro":["română"],
+"roa-rup":["Armãneashce"],
+"roa-tara":["tarandíne"],
+"ru":["русский"],
+"rue":["русиньскый"],
+"rup":["Armãneashce"],
+"ruq":["Vlăheşte"],
+"ruq-cyrl":["Влахесте"],
+"ruq-latn":["Vlăheşte"],
+"sa":["संस्कृतम्"],
+"sah":["саха тыла"],
+"sat":["Santali"],
+"sc":["sardu"],
+"scn":["sicilianu"],
+"sco":["Scots"],
+"sd":["سنڌي"],
+"sdc":["Sassaresu"],
+"se":["sámegiella"],
+"sei":["Cmique Itom"],
+"sg":["Sängö"],
+"sgs":["žemaitėška"],
+"sh":["srpskohrvatski / српскохрватски"],
+"shi":["Tašlḥiyt/ⵜⴰⵛⵍⵃⵉⵜ"],
+"shi-tfng":["ⵜⴰⵛⵍⵃⵉⵜ"],
+"shi-latn":["Tašlḥiyt"],
+"si":["සිංහල"],
+"simple":["Simple English"],
+"sk":["slovenčina"],
+"sl":["slovenščina"],
+"sli":["Schläsch"],
+"sm":["Gagana Samoa"],
+"sma":["Åarjelsaemien"],
+"sn":["chiShona"],
+"so":["Soomaaliga"],
+"sq":["shqip"],
+"sr":["српски / srpski"],
+"sr-ec":["српски (ћирилица)‎"],
+"sr-el":["srpski (latinica)‎"],
+"srn":["Sranantongo"],
+"ss":["SiSwati"],
+"st":["Sesotho"],
+"stq":["Seeltersk"],
+"su":["Basa Sunda"],
+"sv":["svenska"],
+"sw":["Kiswahili"],
+"szl":["ślůnski"],
+"ta":["தமிழ்"],
+"tcy":["ತುಳು"],
+"te":["తెలుగు"],
+"tet":["tetun"],
+"tg":["тоҷикӣ"],
+"tg-cyrl":["тоҷикӣ"],
+"tg-latn":["tojikī"],
+"th":["ไทย"],
+"ti":["ትግርኛ"],
+"tk":["Türkmençe"],
+"tl":["Tagalog"],
+"tly":["толышә зывон"],
+"tn":["Setswana"],
+"to":["lea faka-Tonga"],
+"tokipona":["Toki Pona"],
+"tpi":["Tok Pisin"],
+"tr":["Türkçe"],
+"tru":["Ṫuroyo"],
+"ts":["Xitsonga"],
+"tt":["татарча/tatarça"],
+"tt-cyrl":["татарча"],
+"tt-latn":["tatarça"],
+"tum":["chiTumbuka"],
+"tw":["Twi"],
+"ty":["Reo Mā`ohi"],
+"tyv":["тыва дыл"],
+"udm":["удмурт"],
+"ug":["ئۇيغۇرچە / Uyghurche"],
+"ug-arab":["ئۇيغۇرچە"],
+"ug-latn":["Uyghurche"],
+"uk":["українська"],
+"ur":["اردو"],
+"uz":["oʻzbekcha"],
+"ve":["Tshivenda"],
+"vec":["vèneto"],
+"vep":["vepsän kel’"],
+"vi":["Tiếng Việt"],
+"vls":["West-Vlams"],
+"vmf":["Mainfränkisch"],
+"vo":["Volapük"],
+"vot":["Vaďďa"],
+"vro":["Võro"],
+"wa":["walon"],
+"war":["Winaray"],
+"wo":["Wolof"],
+"wuu":["吴语"],
+"xal":["хальмг"],
+"xh":["isiXhosa"],
+"xmf":["მარგალური"],
+"yi":["ייִדיש"],
+"yo":["Yorùbá"],
+"yue":["粵語"],
+"za":["Vahcuengh"],
+"zea":["Zeêuws"],
+"zh":["中文"],
+"zh-classical":["文言"],
+"zh-cn":["中文(中国大陆)‎"],
+"zh-hans":["中文(简体)‎"],
+"zh-hant":["中文(繁體)‎"],
+"zh-hk":["中文(香港)‎"],
+"zh-min-nan":["Bân-lâm-gú"],
+"zh-mo":["中文(澳門)‎"],
+"zh-my":["中文(马来西亚)‎"],
+"zh-sg":["中文(新加坡)‎"],
+"zh-tw":["中文(台灣)‎"],
+"zh-yue":["粵語"],
+"zu":["isiZulu"]}
+}
diff --git a/languages.json.gz b/languages.json.gz
new file mode 100644
index 0000000..ab60b51
Binary files /dev/null and b/languages.json.gz differ
diff --git a/languages.min.js b/languages.min.js
new file mode 100644
index 0000000..9c60528
--- /dev/null
+++ b/languages.min.js
@@ -0,0 +1,2 @@
+/* From: https://github.com/joker-x/languages4translatewiki */
+(function(exports){var langs={attribute:{nativeName:0},rtl:["ar","dv","fa","ha","he","ks","ku","ps","ur","yi"],lang:{sxu:["Säggssch"],rtm:["Faeag Rotuma"],wls:["Faka'uvea"],twd:["Tweants"],trp:["Kokborok (Tripuri)"],pko:["Pökoot"],pru:["Prūsiskan"],test:["Test (site admin only)"],swb:["Shikomoro"],njo:["Ao"],mni:["মেইতেই লোন্"],ttt:["Tati"],yrl:["ñe'engatú"],krl:["Karjala"],mwv:["Behase Mentawei"],niu:["ko e vagahau Niuē"],bew:["Bahasa Betawi"],rw:["Kinyarwanda"],slr:["Salırça"],ryu:["ʔu [...]
diff --git a/languages.min.js.gz b/languages.min.js.gz
new file mode 100644
index 0000000..5d9d2aa
Binary files /dev/null and b/languages.min.js.gz differ
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..431d904
--- /dev/null
+++ b/package.json
@@ -0,0 +1,22 @@
+{
+  "name": "languages4translatewiki",
+  "version": "0.1.3",
+  "description": "A basic and lightweight replacement for Globalize. Store all languages supported by translatewiki.net in a JSON object, accesible as node module or by browser javascript interpret. No dependencies.",
+  "main": "languages.min.js",
+  "scripts": {
+    "build": "./build/build.sh",
+    "test": "node ./test/node-example.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/joker-x/languages4translatewiki.git"
+  },
+  "keywords": [
+    "globalize",
+    "languages",
+    "i18n"
+  ],
+  "author": "Iván Eixarch <ivan at sinanimodelucro.org>",
+  "license": "GPL",
+  "readmeFilename": "README.md"
+}
diff --git a/test/browser-example.html b/test/browser-example.html
new file mode 100644
index 0000000..93ebff4
--- /dev/null
+++ b/test/browser-example.html
@@ -0,0 +1,45 @@
+<!doctype html>
+<html>
+<head>
+    <title>Test languages module</title>
+    <meta charset="utf-8"> 
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
+    <script src="../languages.min.js"></script>
+    <style>
+    body {
+        background-color: #eee;
+    }
+    .centrador {
+        width:700px;
+        margin:10px auto;
+        border:1px solid #ccc;
+        padding:20px;
+        background-color:#fff;
+    }
+    </style>
+</head>
+<body>
+    <div class="centrador">
+        <h1>Test languages module (Browser client side)</h1>
+        <hr />
+        <div id="test"></div>
+    </div> <!-- .centrador-->
+    <script>
+        var num_languages = 0,
+        text = '';
+
+        // languages.getAllLanguageCode() return an array of all ISO 639-1 language code supported
+        var langscodes = languages.getAllLanguageCode();
+        // iterate this array
+        for (num_languages=0; num_languages<langscodes.length; num_languages++) {
+            // save in text variable a string representation of the object return by languages.getLanguageInfo(langcode)
+            var langcode = langscodes[num_languages];
+            text+='<b>'+langcode+'</b> '+JSON.stringify(languages.getLanguageInfo(langcode))+'<br />';
+        }
+        // save the number of languages supported
+        text = '<h2>Languages supported: '+num_languages+'</h2>'+text;
+        // write the test result in DOM element with id='test'
+        document.getElementById('test').innerHTML = text;
+    </script>
+</body>
+</html>
diff --git a/test/node-example.js b/test/node-example.js
new file mode 100644
index 0000000..521fe86
--- /dev/null
+++ b/test/node-example.js
@@ -0,0 +1,17 @@
+// From node the module is accesible with a simple require
+var languages = require ('../languages.min.js');
+var num_languages = 0;
+
+// languages.getAllLanguageCode() return an array of all ISO 639-1 language code supported
+var langscodes = languages.getAllLanguageCode();
+// iterate this array
+for (num_languages=0; num_languages<langscodes.length; num_languages++) {
+	// show a string representation of the object return by languages.getLanguageInfo(langcode)
+	console.log(langscodes[num_languages]);
+	console.log("   "+JSON.stringify(languages.getLanguageInfo(langscodes[num_languages])));
+}
+// show the number of languages supported
+console.log("Languages supported: "+num_languages);
+// test languages.isValid(langcode) function
+console.log("¿isValid 'kaka' language code? "+languages.isValid('kaka'));
+console.log("¿isValid 'es' language code? "+languages.isValid('es'));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/languages4translatewiki.git



More information about the Pkg-javascript-commits mailing list