mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
Add i18n component
This commit is contained in:
parent
dc3db7a4a8
commit
a3504f70c4
4 changed files with 1051 additions and 1 deletions
24
src/node/hooks/i18n.js
Normal file
24
src/node/hooks/i18n.js
Normal file
|
@ -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)
|
||||
});
|
||||
})
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue