9 lines
297 B
JavaScript
9 lines
297 B
JavaScript
const manager = (errCode = '', lang = 'zh') => {
|
|
if(typeof lang != 'string' || !lang.trim()) lang = 'zh';
|
|
lang = lang.toLowerCase();
|
|
let errors = require(`./language/${lang}.json`);
|
|
if(errCode in errors) return errors[errCode];
|
|
else return 'Error Code not found';
|
|
}
|
|
|
|
module.exports = manager; |