1
0
Fork 0
freesewing/packages/plugin-i18n/src/index.js

19 lines
470 B
JavaScript
Raw Normal View History

2018-08-28 07:28:21 +02:00
import { version, name } from "../package.json";
import locales from "../locales";
export default {
name: name,
version: version,
hooks: {
preRender: function(next) {
this.attributes.add("freesewing:plugin-i18n", version);
next();
},
insertText: function(next) {
if(typeof locales[this.pattern.settings.locale][this.text] === 'string')
this.text = locales[this.pattern.settings.locale][this.text];
next();
}
}
};