boom: Updated to new plugin model
This commit is contained in:
parent
e510a90bc4
commit
f327526fca
11 changed files with 831 additions and 927 deletions
|
@ -1,18 +1,18 @@
|
|||
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();
|
||||
preRender: function(svg) {
|
||||
if(svg.attributes.get('freesewing:plugin-i18n') === false) {
|
||||
svg.attributes.set('freesewing:plugin-i18n', version);
|
||||
}
|
||||
},
|
||||
insertText: function(next) {
|
||||
if(typeof locales[this.pattern.settings.locale][this.text] === 'string')
|
||||
this.text = locales[this.pattern.settings.locale][this.text];
|
||||
next();
|
||||
insertText: function(locale, text, data) {
|
||||
let prefix = data.prefix || "";
|
||||
if(typeof data.strings[locale][prefix+text] === "undefined") return text;
|
||||
else return data.strings[locale][prefix+text];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue