Apply english strings as default translations

This fixes #1303 by ensuring that, if a language does not have a string, the default will be applied.
This commit is contained in:
Matthew Taylor 2017-05-03 14:21:27 -04:00
parent d33cd6cf4b
commit 3a27b1d2e2

View file

@ -32,12 +32,13 @@
}
'''
*/
var fs = require('fs');
var path = require('path');
var merge = require('lodash.merge');
var async = require('async');
var fs = require('fs');
var languages = require('../languages.json');
var localizedUrls = require('./lib/localized-urls');
var merge = require('lodash.merge');
var defaults = require('lodash.defaults');
var path = require('path');
var routes = require('../src/routes.json');
// -----------------------------------------------------------------------------
@ -215,6 +216,7 @@ async.forEachLimit(views, 5, function (view, cb) {
}
try {
viewLocales[isoCode] = merge({}, generalLocales[isoCode], JSON.parse(data));
defaults(viewLocales[isoCode], viewLocales['en']);
} catch (e) {
return cb(e);
}