Comparing version 1.1.7-5 to 1.1.7-6
@@ -7,5 +7,6 @@ var fs = require('fs'), | ||
*/ | ||
module.exports = function i18n(compound) { | ||
module.exports = function i18n(compound, root) { | ||
var app = compound.app; | ||
var dir = compound.root + '/config/locales'; | ||
root = root || compound.root; | ||
var dir = root + '/config/locales'; | ||
@@ -174,5 +175,19 @@ if (!app) { | ||
Object.keys(translations).forEach(function(namespace) { | ||
compound.__localeData[localeName][namespace] = translations[namespace]; | ||
if ('object' === typeof compound.__localeData[localeName] && namespace in compound.__localeData[localeName]) { | ||
merge(compound.__localeData[localeName][namespace], translations[namespace]); | ||
} else { | ||
compound.__localeData[localeName][namespace] = translations[namespace]; | ||
} | ||
}); | ||
}); | ||
function merge(dest, data) { | ||
for (var i in data) { | ||
if (i in dest && typeof dest[i] === 'object') { | ||
merge(dest[i], data[i]); | ||
} else { | ||
dest[i] = data[i]; | ||
} | ||
} | ||
} | ||
} |
@@ -10,3 +10,3 @@ // Deps | ||
*/ | ||
module.exports = function loadModels(compound) { | ||
module.exports = function loadModels(compound, root) { | ||
if (!compound.structure.models) { | ||
@@ -13,0 +13,0 @@ return; |
@@ -48,3 +48,3 @@ var Compound = require('../compound'); | ||
CompoundServer.prototype.init = function initCompoundServer() { | ||
CompoundServer.prototype.init = function initCompoundServer(root) { | ||
var compound = this, time; | ||
@@ -54,3 +54,3 @@ | ||
compound.logger.init(compound); | ||
Compound.prototype.init.call(compound); | ||
Compound.prototype.init.call(compound, root); | ||
@@ -57,0 +57,0 @@ if (compound.app) { |
@@ -71,7 +71,6 @@ var fs = require('fs'); | ||
if (name in contents) { | ||
if ('function' === typeof item) { | ||
for (var i in item.prototype) { | ||
contents[name].prototype[i] = item.prototype[i]; | ||
} | ||
if (name in contents) { | ||
if (key === 'controller') { | ||
for (var i in item.prototype) { | ||
contents[name].prototype[i] = item.prototype[i]; | ||
} | ||
@@ -81,2 +80,5 @@ } else { | ||
} | ||
} else { | ||
contents[name] = item; | ||
} | ||
@@ -83,0 +85,0 @@ if (ext === 'coffee' && !doRequire) { |
{ | ||
"name": "compound", | ||
"version": "1.1.7-5", | ||
"version": "1.1.7-6", | ||
"author": "Anatoliy Chakkaev", | ||
@@ -41,3 +41,3 @@ "contributors": [ | ||
"railway-routes": ">= 0.0.6", | ||
"kontroller": ">= 0.0.9", | ||
"kontroller": ">= 0.0.9-0", | ||
"inflection": "~1.2.5" | ||
@@ -44,0 +44,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
589425
13129
Updatedkontroller@>= 0.0.9-0