vn-rfid/util/translator.js

9 lines
258 B
JavaScript
Raw Normal View History

2023-02-03 12:20:00 +00:00
import yml from 'require-yml';
import path from 'path';
export default function t(expression) {
const {pathname: root} = new URL('./locale', import.meta.url);
let es = yml(path.join(root, 'es.yml')) || {};
return es[expression] || expression;
}