Merge pull request #1184 from joker-x/master
Replace Globalize with languages module
This commit is contained in:
commit
383e1fb604
|
@ -1,4 +1,4 @@
|
||||||
var Globalize = require('globalize')
|
var languages = require('languages')
|
||||||
, fs = require('fs')
|
, fs = require('fs')
|
||||||
, path = require('path')
|
, path = require('path')
|
||||||
, express = require('express')
|
, express = require('express')
|
||||||
|
@ -8,7 +8,8 @@ var localesPath = __dirname+"/../../locales";
|
||||||
// Serve English strings directly with /locales.ini
|
// Serve English strings directly with /locales.ini
|
||||||
var localeIndex = fs.readFileSync(localesPath+'/en.ini')+'\r\n';
|
var localeIndex = fs.readFileSync(localesPath+'/en.ini')+'\r\n';
|
||||||
|
|
||||||
exports.availableLangs = {en: 'English'};
|
// add language base 'en' to availableLangs
|
||||||
|
exports.availableLangs = {en: languages.getLanguageInfo('en')}
|
||||||
|
|
||||||
fs.readdir(localesPath, function(er, files) {
|
fs.readdir(localesPath, function(er, files) {
|
||||||
files.forEach(function(locale) {
|
files.forEach(function(locale) {
|
||||||
|
@ -18,9 +19,8 @@ fs.readdir(localesPath, function(er, files) {
|
||||||
// build locale index
|
// build locale index
|
||||||
localeIndex += '['+locale+']\r\n@import url(locales/'+locale+'.ini)\r\n'
|
localeIndex += '['+locale+']\r\n@import url(locales/'+locale+'.ini)\r\n'
|
||||||
|
|
||||||
require('globalize/lib/cultures/globalize.culture.'+locale+'.js')
|
// add info language {name, nativeName, direction} to availableLangs
|
||||||
var culture = Globalize.cultures[locale];
|
exports.availableLangs[locale]=languages.getLanguageInfo(locale);
|
||||||
exports.availableLangs[culture.name] = culture.nativeName;
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -32,4 +32,4 @@ exports.expressCreateServer = function(n, args) {
|
||||||
res.send(localeIndex);
|
res.send(localeIndex);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"tinycon" : "0.0.1",
|
"tinycon" : "0.0.1",
|
||||||
"underscore" : "1.3.1",
|
"underscore" : "1.3.1",
|
||||||
"unorm" : "1.0.0",
|
"unorm" : "1.0.0",
|
||||||
"globalize" : "0.1.1"
|
"languages" : "0.1.1"
|
||||||
},
|
},
|
||||||
"bin": { "etherpad-lite": "./node/server.js" },
|
"bin": { "etherpad-lite": "./node/server.js" },
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -227,7 +227,7 @@
|
||||||
<td>
|
<td>
|
||||||
<select id="languagemenu">
|
<select id="languagemenu">
|
||||||
<% for (lang in langs) { %>
|
<% for (lang in langs) { %>
|
||||||
<option value="<%=lang%>"><%=langs[lang]%></option>
|
<option value="<%=lang%>"><%=langs[lang].nativeName%></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue