blob: 6238f2cbd940d41739bf3cb5d71e0b183930aef4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
var Globalize = require('globalize')
, fs = require('fs')
, path = require('path')
, express = require('express')
var localesPath = __dirname+"/../../locales";
var localeIndex = '[*]\r\n@import url(locales/en.ini)\r\n';
exports.availableLangs = {en: 'English'};
fs.readdir(localesPath, function(er, files) {
files.forEach(function(locale) {
locale = locale.split('.')[0]
if(locale.toLowerCase() == 'en') return;
// 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;
})
})
exports.expressCreateServer = function(n, args) {
args.app.use('/locales', express.static(localesPath));
args.app.get('/locales.ini', function(req, res) {
res.send(localeIndex);
})
}
|