mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-12 02:01:31 -04:00
Added Translator Assistant
This commit is contained in:
parent
323517c6dc
commit
61bdeafca2
5 changed files with 477 additions and 43 deletions
|
@ -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));
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue