diff --git a/plugins/plugin-annotations/i18n/de.json b/plugins/plugin-annotations/i18n/de.json new file mode 100644 index 00000000000..a11a50fcef4 --- /dev/null +++ b/plugins/plugin-annotations/i18n/de.json @@ -0,0 +1,21 @@ +{ + "canvas": "canvas", + "cut": "Cut", + "cutOnFold": "Cut on fold", + "cutOnFoldAndGrainline": "Cut on fold / Grainline", + "fabric": "main fabric", + "facing": "facing", + "from": "from", + "fusible": "fusible interfacing", + "interfacing": "interfacing", + "lining": "lining", + "mirrored": "mirorred", + "noName": "No name", + "noVersion": "No version", + "onBias": "on the bias", + "onFold": "on the fold", + "onFoldAndBias": "on the fold, and on bias", + "sewTogether": "Sew together", + "theBlackOutideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", + "theWhiteInsideOfThisBoxShouldMeasure": "The (white) inside of this box should measure" +} diff --git a/plugins/plugin-annotations/i18n/en.json b/plugins/plugin-annotations/i18n/en.json new file mode 100644 index 00000000000..a11a50fcef4 --- /dev/null +++ b/plugins/plugin-annotations/i18n/en.json @@ -0,0 +1,21 @@ +{ + "canvas": "canvas", + "cut": "Cut", + "cutOnFold": "Cut on fold", + "cutOnFoldAndGrainline": "Cut on fold / Grainline", + "fabric": "main fabric", + "facing": "facing", + "from": "from", + "fusible": "fusible interfacing", + "interfacing": "interfacing", + "lining": "lining", + "mirrored": "mirorred", + "noName": "No name", + "noVersion": "No version", + "onBias": "on the bias", + "onFold": "on the fold", + "onFoldAndBias": "on the fold, and on bias", + "sewTogether": "Sew together", + "theBlackOutideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", + "theWhiteInsideOfThisBoxShouldMeasure": "The (white) inside of this box should measure" +} diff --git a/plugins/plugin-annotations/i18n/es.json b/plugins/plugin-annotations/i18n/es.json new file mode 100644 index 00000000000..a11a50fcef4 --- /dev/null +++ b/plugins/plugin-annotations/i18n/es.json @@ -0,0 +1,21 @@ +{ + "canvas": "canvas", + "cut": "Cut", + "cutOnFold": "Cut on fold", + "cutOnFoldAndGrainline": "Cut on fold / Grainline", + "fabric": "main fabric", + "facing": "facing", + "from": "from", + "fusible": "fusible interfacing", + "interfacing": "interfacing", + "lining": "lining", + "mirrored": "mirorred", + "noName": "No name", + "noVersion": "No version", + "onBias": "on the bias", + "onFold": "on the fold", + "onFoldAndBias": "on the fold, and on bias", + "sewTogether": "Sew together", + "theBlackOutideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", + "theWhiteInsideOfThisBoxShouldMeasure": "The (white) inside of this box should measure" +} diff --git a/plugins/plugin-annotations/i18n/fr.json b/plugins/plugin-annotations/i18n/fr.json new file mode 100644 index 00000000000..a11a50fcef4 --- /dev/null +++ b/plugins/plugin-annotations/i18n/fr.json @@ -0,0 +1,21 @@ +{ + "canvas": "canvas", + "cut": "Cut", + "cutOnFold": "Cut on fold", + "cutOnFoldAndGrainline": "Cut on fold / Grainline", + "fabric": "main fabric", + "facing": "facing", + "from": "from", + "fusible": "fusible interfacing", + "interfacing": "interfacing", + "lining": "lining", + "mirrored": "mirorred", + "noName": "No name", + "noVersion": "No version", + "onBias": "on the bias", + "onFold": "on the fold", + "onFoldAndBias": "on the fold, and on bias", + "sewTogether": "Sew together", + "theBlackOutideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", + "theWhiteInsideOfThisBoxShouldMeasure": "The (white) inside of this box should measure" +} diff --git a/plugins/plugin-annotations/i18n/index.mjs b/plugins/plugin-annotations/i18n/index.mjs new file mode 100644 index 00000000000..36aac928b67 --- /dev/null +++ b/plugins/plugin-annotations/i18n/index.mjs @@ -0,0 +1,8 @@ +import en from './en.json' assert { type: 'json' } +import de from './de.json' assert { type: 'json' } +import es from './es.json' assert { type: 'json' } +import fr from './fr.json' assert { type: 'json' } +import nl from './nl.json' assert { type: 'json' } +import uk from './uk.json' assert { type: 'json' } + +export const i18n = { en, de, es, fr, nl, uk } diff --git a/plugins/plugin-annotations/i18n/nl.json b/plugins/plugin-annotations/i18n/nl.json new file mode 100644 index 00000000000..a11a50fcef4 --- /dev/null +++ b/plugins/plugin-annotations/i18n/nl.json @@ -0,0 +1,21 @@ +{ + "canvas": "canvas", + "cut": "Cut", + "cutOnFold": "Cut on fold", + "cutOnFoldAndGrainline": "Cut on fold / Grainline", + "fabric": "main fabric", + "facing": "facing", + "from": "from", + "fusible": "fusible interfacing", + "interfacing": "interfacing", + "lining": "lining", + "mirrored": "mirorred", + "noName": "No name", + "noVersion": "No version", + "onBias": "on the bias", + "onFold": "on the fold", + "onFoldAndBias": "on the fold, and on bias", + "sewTogether": "Sew together", + "theBlackOutideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", + "theWhiteInsideOfThisBoxShouldMeasure": "The (white) inside of this box should measure" +} diff --git a/plugins/plugin-annotations/i18n/uk.json b/plugins/plugin-annotations/i18n/uk.json new file mode 100644 index 00000000000..a11a50fcef4 --- /dev/null +++ b/plugins/plugin-annotations/i18n/uk.json @@ -0,0 +1,21 @@ +{ + "canvas": "canvas", + "cut": "Cut", + "cutOnFold": "Cut on fold", + "cutOnFoldAndGrainline": "Cut on fold / Grainline", + "fabric": "main fabric", + "facing": "facing", + "from": "from", + "fusible": "fusible interfacing", + "interfacing": "interfacing", + "lining": "lining", + "mirrored": "mirorred", + "noName": "No name", + "noVersion": "No version", + "onBias": "on the bias", + "onFold": "on the fold", + "onFoldAndBias": "on the fold, and on bias", + "sewTogether": "Sew together", + "theBlackOutideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", + "theWhiteInsideOfThisBoxShouldMeasure": "The (white) inside of this box should measure" +} diff --git a/plugins/plugin-annotations/src/cutonfold.mjs b/plugins/plugin-annotations/src/cutonfold.mjs index 49181340f5c..29221eed9d8 100644 --- a/plugins/plugin-annotations/src/cutonfold.mjs +++ b/plugins/plugin-annotations/src/cutonfold.mjs @@ -56,6 +56,9 @@ const cutonfold = function (config, { points, paths, Path, complete, store, scal */ const mc = { ...macroDefaults, + text: config.grainline + ? 'plugin-annotations:cutOnFoldAndGrainline' + : 'plugin-annotations:cutOnFold', ...config, classes: macroDefaults.classes, } @@ -99,7 +102,7 @@ const cutonfold = function (config, { points, paths, Path, complete, store, scal .attr('class', mc.classes.line) .attr('marker-start', 'url(#cutonfoldFrom)') .attr('marker-end', 'url(#cutonfoldTo)') - .addText(mc.grainline ? 'cutOnFoldAndGrainline' : 'cutOnFold', mc.classes.text) + .addText(mc.text, mc.classes.text) /* * Store all IDs in the store so we can remove this macro with rmcutonfold diff --git a/plugins/plugin-annotations/src/dimensions.mjs b/plugins/plugin-annotations/src/dimensions.mjs index 38f4342b26d..4feb0b63ca9 100644 --- a/plugins/plugin-annotations/src/dimensions.mjs +++ b/plugins/plugin-annotations/src/dimensions.mjs @@ -193,9 +193,9 @@ export const dimensionsMacros = { rmld: (id, props) => removeDimension(id, props, 'ld'), rmvd: (id, props) => removeDimension(id, props, 'vd'), rmpd: (id, props) => removeDimension(id, props, 'pd'), - rmhd: (config, props) => removeDimensionType(props, 'hd'), - rmld: (config, props) => removeDimensionType(props, 'ld'), - rmvd: (config, props) => removeDimensionType(props, 'vd'), - rmpd: (config, props) => removeDimensionType(props, 'pd'), + rmahd: (config, props) => removeDimensionType(props, 'hd'), + rmald: (config, props) => removeDimensionType(props, 'ld'), + rmavd: (config, props) => removeDimensionType(props, 'vd'), + rmapd: (config, props) => removeDimensionType(props, 'pd'), rmad: (config, props) => removeAllDimensions(props), } diff --git a/plugins/plugin-annotations/src/grainline.mjs b/plugins/plugin-annotations/src/grainline.mjs index fee769b6b82..1927e75886c 100644 --- a/plugins/plugin-annotations/src/grainline.mjs +++ b/plugins/plugin-annotations/src/grainline.mjs @@ -10,7 +10,7 @@ const macroDefaults = { }, id: 'grainline', margin: 0.05, - text: 'grainline', + text: 'plugin-annotations:grainline', } // Export defs diff --git a/plugins/plugin-annotations/src/index.mjs b/plugins/plugin-annotations/src/index.mjs index 96be11fde67..24bff66d380 100644 --- a/plugins/plugin-annotations/src/index.mjs +++ b/plugins/plugin-annotations/src/index.mjs @@ -1,4 +1,6 @@ import { name, version } from '../data.mjs' +// i18n +import { i18n as i18nAnnotations } from '../i18n/index.mjs' // Defs only import { buttonsDefs } from './buttons.mjs' import { logoDefs } from './logo.mjs' @@ -62,3 +64,4 @@ export const plugin = { export const annotationsPlugin = plugin export const pluginAnnotations = plugin +export const i18n = i18nAnnotations diff --git a/plugins/plugin-annotations/src/scalebox.mjs b/plugins/plugin-annotations/src/scalebox.mjs index 5a6a2bdaaf1..e6fb6e9c564 100644 --- a/plugins/plugin-annotations/src/scalebox.mjs +++ b/plugins/plugin-annotations/src/scalebox.mjs @@ -7,11 +7,15 @@ const macroDefaults = { classes: { lead: 'text-xs bold', title: 'text bold', - text: 'text-sm', - link: 'text-sm fill-note', + text: 'text-xs', + link: 'text-sm fill-note bold', metric: 'text-xs center', imperial: 'text-xs center', }, + lead: 'FreeSewing', + link: 'FreeSewing.org/patrons/join', + text: 'plugin-annotations:supportFreesewingBecomeAPatron', + title: false, } /* @@ -191,7 +195,7 @@ const scalebox = function (config, { store, points, paths, scale, Point, Path, c * Add lead text to the part points */ points[ids.textLead] = text.lead - .addText(mc.lead || 'FreeSewing', mc.classes.lead) + .addText(mc.lead, mc.classes.lead) .attr('data-text-class', 'text-sm') /* @@ -199,7 +203,7 @@ const scalebox = function (config, { store, points, paths, scale, Point, Path, c */ let title = mc.title if (!title) { - title = store.data?.name || 'No Name' + title = store.data?.name || 'plugin-annotations:noName' if (title.indexOf('@freesewing/') !== -1) title = title.replace('@freesewing/', '') } points[ids.textTitle] = text.title @@ -209,23 +213,18 @@ const scalebox = function (config, { store, points, paths, scale, Point, Path, c /* * Add text text to the part points */ - points[ids.textText] = text.text.addText( - typeof mc.text === 'string' ? mc.text : 'supportFreesewingBecomeAPatron', - mc.classes.text - ) + points[ids.textText] = text.text.addText(mc.text, mc.classes.text) /* * Add link text to the part points */ - points[ids.textLink] = text.link - .addText('freesewing.org/patrons/join', mc.classes.link) - .attr('data-text-lineheight', 4) + points[ids.textLink] = text.link.addText(mc.link, mc.classes.link).attr('data-text-lineheight', 4) /* * Add metric instructions text to the part points */ points[ids.textMetric] = text.metric - .attr('data-text', 'theWhiteInsideOfThisBoxShouldMeasure') + .attr('data-text', 'plugin-annotations:theWhiteInsideOfThisBoxShouldMeasure') .attr('data-text', mdw) .attr('data-text', 'x') .attr('data-text', mdh) @@ -235,7 +234,7 @@ const scalebox = function (config, { store, points, paths, scale, Point, Path, c * Add imperial instructions text to the part points */ points[ids.textImperial] = text.imperial - .attr('data-text', 'theBlackOutsideOfThisBoxShouldMeasure') + .attr('data-text', 'plugin-annotations:theBlackOutsideOfThisBoxShouldMeasure') .attr('data-text', idw) .attr('data-text', 'x') .attr('data-text', idh) diff --git a/plugins/plugin-annotations/src/sewtogether.mjs b/plugins/plugin-annotations/src/sewtogether.mjs index 4bc939a0284..810ae516250 100644 --- a/plugins/plugin-annotations/src/sewtogether.mjs +++ b/plugins/plugin-annotations/src/sewtogether.mjs @@ -4,13 +4,14 @@ import { getIds } from './utils.mjs' * Defaults for the sewtogether macro */ const macroDefaults = { - id: 'sewtogether', - force: false, classes: { curve: 'dotted note stroke-sm', hinge: 'note dotted stroke-sm', text: 'center fill-note text-xs', }, + id: 'sewtogether', + force: false, + text: 'plugin-annotations:sewTogether', } // Export defs @@ -101,7 +102,7 @@ const sewtogether = function (config, { points, paths, Path, complete, sa, store .attr('class', mc.classes.curve) .attr('marker-start', 'url(#sewTogetherStart)') .attr('marker-end', 'url(#sewTogetherEnd)') - .addText('sewTogether', mc.classes.text) + .addText(mc.text, mc.classes.text) /* * Draw the hinge, if needed diff --git a/plugins/plugin-annotations/src/title.mjs b/plugins/plugin-annotations/src/title.mjs index f049b1b5fdf..57ed94a6b54 100644 --- a/plugins/plugin-annotations/src/title.mjs +++ b/plugins/plugin-annotations/src/title.mjs @@ -13,7 +13,7 @@ const macroDefaults = { nr: 1, rotation: 0, scale: 1, - title: 'title', + title: 'plugin-annotations:noName', classes: { cutlist: 'text-md fill-current', date: 'text-sm fill-current', @@ -144,7 +144,7 @@ const addTitleMacro = function ( points[id] = mc.at .clone() .shift(-90, shift) - .attr('data-text', 'plugin:cut') + .attr('data-text', 'plugin-annotations:cut') .attr('data-text-class', `${mc.classes.cutlist} ${mc.align}`) .attr('data-text-transform', transform) .addText(cut) @@ -153,21 +153,23 @@ const addTitleMacro = function ( /* * Add instructions if parts are mirrored */ - if (!identical && cut > 1) points[id].addText('plugin:mirrored') + if (!identical && cut > 1) points[id].addText('plugin-annotations:mirrored') /* * Add instructions if parts are cut on fold */ if (partCutlist.cutOnFold && !ignoreOnFold) - points[id].addText(bias ? 'plugin:onFoldAndBias' : 'plugin:onFoldLower') + points[id].addText( + bias ? 'plugin-annotations:onFoldAndBias' : 'plugin-annotations:onFold' + ) /* * Add instructions if parts on on bias - */ else if (bias) points[id].addText('plugin:onBias') + */ else if (bias) points[id].addText('plugin-annotations:onBias') /* * Add 'from' (material) text */ - points[id].addText('plugin:from').addText('plugin:' + material) + points[id].addText('plugin-annotations:from').addText('plugin-annotations:' + material) }) } } @@ -181,8 +183,8 @@ const addTitleMacro = function ( .shift(-90, shift) .attr( 'data-text', - `${(store.data?.name || 'noName').replace('@freesewing/', '')} v ${ - store.data?.version || 'noVersion' + `${(store.data?.name || 'plugin-annotations:noName').replace('@freesewing/', '')} v ${ + store.data?.version || 'plugin-annotations:noVersion' }` ) .attr('data-text-class', `${mc.classes.name} ${mc.align}`)