some fixes

This commit is contained in:
Wyatt Johnson
2017-12-14 16:09:41 -06:00
parent d3965924aa
commit d9654b52cf
2 changed files with 8 additions and 9 deletions
+5 -6
View File
@@ -41,7 +41,7 @@ const loadPluginTranslations = () => {
}
// Load the plugin translations.
plugins.forEach('server', 'translations').forEach(({plugin, translations: filename}) => {
plugins.get('server', 'translations').forEach(({plugin, translations: filename}) => {
debug(`added plugin '${plugin.name}'`);
const pack = yaml.parse(fs.readFileSync(filename, 'utf8'));
@@ -62,11 +62,6 @@ const i18n = {
* Create the new Task kue.
*/
init(req) {
// Loads the translations into the translations array from plugins. This is
// done lazily to ensure that we don't have an import cycle.
loadPluginTranslations();
const lang = accepts(req).language(languages);
language = lang ? lang : defaultLanguage;
},
@@ -76,6 +71,10 @@ const i18n = {
*/
t(key, ...replacements) {
// Loads the translations into the translations array from plugins. This is
// done lazily to ensure that we don't have an import cycle.
loadPluginTranslations();
// Check if the translation exists on the object.
if (_.has(translations[language], key)) {
+3 -3
View File
@@ -99,8 +99,8 @@ const mailer = module.exports = {
attachLocals(locals);
// Attach the templating function.
locals['t'] = i18n.t;
// Attach the translation function.
locals.t = i18n.t;
return Promise.all([
@@ -112,7 +112,7 @@ const mailer = module.exports = {
])
.then(([html, text]) => {
// Create the job.
// Create the job.
return mailer.task.create({
title: 'Mail',
message: {