Add i18n component
parent
dc3db7a4a8
commit
a3504f70c4
|
@ -5,6 +5,7 @@
|
|||
"restartServer": "ep_etherpad-lite/node/hooks/express:restartServer"
|
||||
} },
|
||||
{ "name": "static", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/static:expressCreateServer" } },
|
||||
{ "name": "i18n", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/i18n:expressCreateServer" } },
|
||||
{ "name": "specialpages", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/specialpages:expressCreateServer" } },
|
||||
{ "name": "padurlsanitize", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/padurlsanitize:expressCreateServer" } },
|
||||
{ "name": "padreadonly", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/padreadonly:expressCreateServer" } },
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
var Globalize = require('globalize')
|
||||
, fs = require('fs')
|
||||
, path = require('path')
|
||||
|
||||
fs.readdir(__dirname+"/../../locales", function(er, files) {
|
||||
files.forEach(function(locale) {
|
||||
locale = locale.split('.')[0]
|
||||
if(locale.toLowerCase() == 'en') return;
|
||||
require('globalize/lib/cultures/globalize.culture.'+locale+'.js')
|
||||
})
|
||||
})
|
||||
|
||||
exports.expressCreateServer = function(n, args) {
|
||||
|
||||
args.app.get('/locale.ini', function(req, res) {
|
||||
|
||||
Globalize.culture( req.header('Accept-Language') || 'en' );
|
||||
var localePath = path.normalize(__dirname +"/../../locales/"+Globalize.culture().name+".ini");
|
||||
res.sendfile(localePath, function(er) {
|
||||
if(er) console.error(er)
|
||||
});
|
||||
})
|
||||
|
||||
}
|
|
@ -35,7 +35,8 @@
|
|||
"security" : "1.0.0",
|
||||
"tinycon" : "0.0.1",
|
||||
"underscore" : "1.3.1",
|
||||
"unorm" : "1.0.0"
|
||||
"unorm" : "1.0.0",
|
||||
"globalize" : "0.1.1"
|
||||
},
|
||||
"bin": { "etherpad-lite": "./node/server.js" },
|
||||
"devDependencies": {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue