Skip to content

Commit

Permalink
Refactor: Moving translations to main app file
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlelek committed Feb 13, 2016
1 parent 4c963dc commit bcbef34
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ var raneto = require('raneto-core');

function initialize (config) {

// Load Translations
if (!config.locale) { config.locale = 'en'; }
config.lang = require('./translations/' + config.locale + '.json');

// Setup config
extend(raneto.config, config);

Expand Down Expand Up @@ -59,6 +63,7 @@ function initialize (config) {
app.use(cookie_parser());
app.use(express.static(config.public_dir));
app.use(config.image_url, express.static(path.normalize(config.content_dir + config.image_url)));
app.use('/translations', express.static(path.normalize(__dirname + '/translations')));

// HTTP Authentication
if (config.authentication === true) {
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 4 additions & 5 deletions example/config.default.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

'use strict';

// Exports
var config = module.exports = {
var config = {

// Your site title (format: page_title - site_title)
site_title: 'Raneto Docs',
Expand Down Expand Up @@ -34,7 +33,7 @@ var config = module.exports = {
// Specify the path of your content folder where all your '.md' files are located
// Fix: Needs trailing slash for now!
// Fix: Cannot be an absolute path
content_dir : 'content/',
content_dir : __dirname + '/../content/',

// Where is the public directory or document root?
public_dir : __dirname + '/../themes/default/public/',
Expand Down Expand Up @@ -67,5 +66,5 @@ var config = module.exports = {

};

// load translations
config.lang = require('../themes/default/public/translations/' + config.locale + '.json');
// Exports
module.exports = config;

0 comments on commit bcbef34

Please sign in to comment.