Skip to content

Commit

Permalink
allow multiple files for translations
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed Dec 30, 2013
1 parent 6299415 commit cb07bc9
Show file tree
Hide file tree
Showing 25 changed files with 434 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions locales/en/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var _ = require('lodash');

var files = [
// List of files containing translations
require('./main.json'),
require('./secondary.json')
];

module.exports = {};

_.each(files, function(file){
_.merge(module.exports, file);
});
417 changes: 417 additions & 0 deletions locales/en/main.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions locales/en/secondary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"secondaryString": "an example"
}
2 changes: 1 addition & 1 deletion src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var getManifestFiles = function(page){
var translations = {};

var loadTranslations = function(locale){
translations[locale] = require(path.join(__dirname, "/../locales/", locale, 'app.json'));
translations[locale] = require(path.join(__dirname, "/../locales/", locale, 'app.js'));
}

// First fetch english so we can merge with missing strings in other languages
Expand Down

0 comments on commit cb07bc9

Please sign in to comment.