Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
[#318] Use config for setting locales…
Browse files Browse the repository at this point in the history
…and ensure we set locale *after* config is fully loaded.
  • Loading branch information
andylolz committed May 27, 2014
1 parent 402f3d9 commit d5af510
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/i18n.js
@@ -1,13 +1,14 @@
var i18n = require('i18n-abide')
, fs = require('fs')
, config = require('./config')
, locales
, _ = require('underscore')
;

module.exports = {
locales: function() {
locales = locales ||
_.without(fs.readdirSync(__dirname + '/../locale'), 'templates');
config.get('locales');

return locales;
},
Expand All @@ -16,7 +17,7 @@ module.exports = {

app.use(i18n.abide({
supported_languages: locales,
default_lang: 'en',
default_lang: _.first(locales),
translation_directory: 'locale'
}));
}
Expand Down
6 changes: 4 additions & 2 deletions run.js
@@ -1,8 +1,7 @@
var model = require('./lib/model').OpenDataCensus
, app = require('./app').app
, census = require('./routes/census')
, config = require('./lib/config')
;
;

// Booting up
// ========================================================
Expand All @@ -15,6 +14,9 @@ model.load(function(err) {
console.error('Failed to load dataset info');
throw err;
}

app = require('./app').app

// Passport Auth Stuff (Facebook etc)
// set up here rather than app.js as must be after config load to
// get site_url
Expand Down

0 comments on commit d5af510

Please sign in to comment.