Added Translator Assistant

This commit is contained in:
Iván Eixarch 2012-11-18 23:22:28 +01:00
parent 323517c6dc
commit 61bdeafca2
5 changed files with 477 additions and 43 deletions

View file

@ -1,9 +1,12 @@
var Globalize = require('globalize')
, fs = require('fs')
, path = require('path')
, eejs = require('ep_etherpad-lite/node/eejs')
, express = require('express')
, translate = require ('../utils/translate')
var localesPath = __dirname+"/../../locales";
var localesPath = __dirname+"/../../locales"
, templatesPath = __dirname+"/../../templates";
// Serve English strings directly with /locales.ini
var localeIndex = fs.readFileSync(localesPath+'/en.ini')+'\r\n';
@ -30,6 +33,18 @@ exports.expressCreateServer = function(n, args) {
args.app.get('/locales.ini', function(req, res) {
res.send(localeIndex);
})
});
args.app.get('/translate', function(req, res) {
res.send( eejs.require("ep_etherpad-lite/templates/translate.html", {}) );
});
args.app.get('/translate/:lang_code', function(req, res) {
var lang_code = req.params.lang_code.substr(0,2),
ids = translate.extractIDs(templatesPath);
res.charset = 'utf-8';
res.contentType('text');
res.send(translate.getTranslationINI(localesPath, lang_code, ids));
});
}
}