feat(plugin-annotations): Add i18n
This commit is contained in:
parent
84785f67c6
commit
9ae94abd02
14 changed files with 172 additions and 30 deletions
21
plugins/plugin-annotations/i18n/de.json
Normal file
21
plugins/plugin-annotations/i18n/de.json
Normal file
|
@ -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"
|
||||
}
|
21
plugins/plugin-annotations/i18n/en.json
Normal file
21
plugins/plugin-annotations/i18n/en.json
Normal file
|
@ -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"
|
||||
}
|
21
plugins/plugin-annotations/i18n/es.json
Normal file
21
plugins/plugin-annotations/i18n/es.json
Normal file
|
@ -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"
|
||||
}
|
21
plugins/plugin-annotations/i18n/fr.json
Normal file
21
plugins/plugin-annotations/i18n/fr.json
Normal file
|
@ -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"
|
||||
}
|
8
plugins/plugin-annotations/i18n/index.mjs
Normal file
8
plugins/plugin-annotations/i18n/index.mjs
Normal file
|
@ -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 }
|
21
plugins/plugin-annotations/i18n/nl.json
Normal file
21
plugins/plugin-annotations/i18n/nl.json
Normal file
|
@ -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"
|
||||
}
|
21
plugins/plugin-annotations/i18n/uk.json
Normal file
21
plugins/plugin-annotations/i18n/uk.json
Normal file
|
@ -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"
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ const macroDefaults = {
|
|||
},
|
||||
id: 'grainline',
|
||||
margin: 0.05,
|
||||
text: 'grainline',
|
||||
text: 'plugin-annotations:grainline',
|
||||
}
|
||||
|
||||
// Export defs
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue