Merge pull request #1223 from joker-x/languages4translatewiki

Added support for *all* translatewiki languages
pull/1257/head
Marcel Klehr 2012-12-04 04:09:17 -08:00
commit ce71002644
2 changed files with 33 additions and 32 deletions

View File

@ -1,4 +1,4 @@
var languages = require('languages')
var languages = require('languages4translatewiki')
, fs = require('fs')
, path = require('path')
, express = require('express')
@ -8,22 +8,23 @@ var localesPath = __dirname+"/../../locales";
// Serve English strings directly with /locales.ini
var localeIndex = fs.readFileSync(localesPath+'/en.ini')+'\r\n';
// add language base 'en' to availableLangs
exports.availableLangs = {en: languages.getLanguageInfo('en')}
exports.availableLangs = {'en': {'nativeName': 'English', 'direction': 'ltr'}};
fs.readdir(localesPath, function(er, files) {
files.forEach(function(locale) {
locale = locale.split('.')[0]
if(locale.toLowerCase() == 'en') return;
var ext = path.extname(locale);
locale = path.basename(locale, ext).toLowerCase();
if(locale == 'en' || ext != '.ini') return;
// build locale index
localeIndex += '['+locale+']\r\n@import url(locales/'+locale+'.ini)\r\n'
// add info language {name, nativeName, direction} to availableLangs
// add info language {nativeName, direction} to availableLangs
exports.availableLangs[locale]=languages.getLanguageInfo(locale);
})
})
exports.expressCreateServer = function(n, args) {
args.app.use('/locales', express.static(localesPath));

View File

@ -36,7 +36,7 @@
"tinycon" : "0.0.1",
"underscore" : "1.3.1",
"unorm" : "1.0.0",
"languages" : "0.1.1"
"languages4translatewiki" : "0.1.3"
},
"bin": { "etherpad-lite": "./node/server.js" },
"devDependencies": {