diff --git a/src/node/hooks/i18n.js b/src/node/hooks/i18n.js
index 67170ab3..6238f2cb 100644
--- a/src/node/hooks/i18n.js
+++ b/src/node/hooks/i18n.js
@@ -1,13 +1,21 @@
var Globalize = require('globalize')
, fs = require('fs')
, path = require('path')
+ , express = require('express')
-exports.availableLangs = {en: 'English'}
-fs.readdir(__dirname+"/../../locales", function(er, files) {
+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;
@@ -16,13 +24,10 @@ fs.readdir(__dirname+"/../../locales", function(er, files) {
exports.expressCreateServer = function(n, args) {
- args.app.get('/locale.ini', function(req, res) {
- // 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)
- });
+ args.app.use('/locales', express.static(localesPath));
+
+ args.app.get('/locales.ini', function(req, res) {
+ res.send(localeIndex);
})
}
\ No newline at end of file
diff --git a/src/templates/index.html b/src/templates/index.html
index 23f24c53..ee3009dd 100644
--- a/src/templates/index.html
+++ b/src/templates/index.html
@@ -32,7 +32,7 @@
-
+