mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: optional params
This commit is contained in:
@@ -605,8 +605,18 @@
|
|||||||
warn('Translation failed: ' + err.stack);
|
warn('Translation failed: ' + err.stack);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
translateKeys: async function (keys, language, cb) {
|
translateKeys: async function (keys, language, callback) {
|
||||||
return await Promise.all(keys.map(key => adaptor.translate(key, language, cb)));
|
let cb = callback;
|
||||||
|
let lang = language;
|
||||||
|
if (typeof language === 'function') {
|
||||||
|
cb = language;
|
||||||
|
lang = null;
|
||||||
|
}
|
||||||
|
const translations = await Promise.all(keys.map(key => adaptor.translate(key, lang)));
|
||||||
|
if (typeof cb === 'function') {
|
||||||
|
return setTimeout(cb, 0, translations);
|
||||||
|
}
|
||||||
|
return translations;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user