Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
larafale committed Sep 21, 2012
2 parents 3fcece0 + aa4b821 commit 90f9888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -59,7 +59,7 @@ As `en` is set to be the default, when making a request to `/en/products` you wi

#### Translation files
Every translation file is JSON and must end with .json
You can have as many file you want for each locale. This let you seperate content.
You can have as many files as you want for each locale. This let you seperate content.
For example : `en.json` `header_en.json` `footer_en.json`
<br/>
Each file start with the `locale` key.
Expand Down
12 changes: 7 additions & 5 deletions lib/node-i18n.js
Expand Up @@ -33,11 +33,13 @@ module.exports = function (options) {
this.files = fs.readdirSync(this.options.dir)

this.load = function(){
_.each(this.files, function(file){
this.words = _.extend(self.words, require(self.options.dir + '/' + file))
})
return this
}
_.each(this.files, function(file){
fileContents = require(self.options.dir + '/' + file)
fileLocale = _.keys(fileContents)[0]
self.words[fileLocale] = _.extend(self.words[fileLocale] || {}, fileContents[fileLocale])
})
return this
}

this.translateHelper = function(locale){
return function(key, variables, forcedLocale) {
Expand Down

0 comments on commit 90f9888

Please sign in to comment.