mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Add pad setting for UI lang
This commit is contained in:
parent
fb340793da
commit
7021a8b885
5 changed files with 24 additions and 3 deletions
|
@ -2,19 +2,23 @@ var Globalize = require('globalize')
|
|||
, fs = require('fs')
|
||||
, path = require('path')
|
||||
|
||||
exports.availableLangs = {}
|
||||
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')
|
||||
var culture = Globalize.cultures[locale];
|
||||
exports.availableLangs[culture.name] = culture.nativeName;
|
||||
})
|
||||
})
|
||||
|
||||
exports.expressCreateServer = function(n, args) {
|
||||
|
||||
args.app.get('/locale.ini', function(req, res) {
|
||||
|
||||
Globalize.culture( req.header('Accept-Language') || 'en' );
|
||||
// let gloablize find out the preferred locale and default to 'en'
|
||||
Globalize.culture(req.cookies['language'] || 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