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