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; }