mirror of
https://github.com/wassname/talk.git
synced 2026-07-20 12:40:47 +08:00
some fixes
This commit is contained in:
+5
-6
@@ -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
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user