diff --git a/plugins/plugin-annotations/i18n/en.json b/plugins/plugin-annotations/i18n/en.json index a11a50fcef4..8264fd4da38 100644 --- a/plugins/plugin-annotations/i18n/en.json +++ b/plugins/plugin-annotations/i18n/en.json @@ -16,6 +16,7 @@ "onFold": "on the fold", "onFoldAndBias": "on the fold, and on bias", "sewTogether": "Sew together", - "theBlackOutideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", + "supportFreeSewingBecomeAPatron": "Support FreeSewing, become a patron", + "theBlackOutsideOfThisBoxShouldMeasure": "The (black) outside of this box should measure", "theWhiteInsideOfThisBoxShouldMeasure": "The (white) inside of this box should measure" } diff --git a/plugins/plugin-annotations/src/scalebox.mjs b/plugins/plugin-annotations/src/scalebox.mjs index e6fb6e9c564..f7b600a2261 100644 --- a/plugins/plugin-annotations/src/scalebox.mjs +++ b/plugins/plugin-annotations/src/scalebox.mjs @@ -14,7 +14,7 @@ const macroDefaults = { }, lead: 'FreeSewing', link: 'FreeSewing.org/patrons/join', - text: 'plugin-annotations:supportFreesewingBecomeAPatron', + text: 'plugin-annotations:supportFreeSewingBecomeAPatron', title: false, } diff --git a/sites/shared/components/workbench/new.mjs b/sites/shared/components/workbench/new.mjs index 65e5e119798..2a6aa7e26cc 100644 --- a/sites/shared/components/workbench/new.mjs +++ b/sites/shared/components/workbench/new.mjs @@ -39,6 +39,7 @@ export const ns = [ ...logNs, ...inspectNs, ...measiesNs, + 'plugin-annotations', ] const defaultUi = { @@ -184,14 +185,13 @@ export const Workbench = ({ design, Design, DynamicDocs }) => { const pattern = (Design.patternConfig.measurements.length === 0 || settings.measurements !== undefined) && new Design({ layout, embed: true, ...settings }) - // Return early if the pattern is not initialized yet if (typeof pattern.getConfig !== 'function') return null const patternConfig = pattern.getConfig() if (ui.renderer === 'svg') { // Add theme to svg renderer - pattern.use(pluginI18n, (key) => t(key, { ns: design })) + pattern.use(pluginI18n, (key) => t(key)) pattern.use(pluginTheme, { skipGrid: ['pages'] }) } diff --git a/sites/shared/i18n/plugins.mjs b/sites/shared/i18n/plugins.mjs new file mode 100644 index 00000000000..c8bcff099c8 --- /dev/null +++ b/sites/shared/i18n/plugins.mjs @@ -0,0 +1,5 @@ +import { i18n as annotations } from '@freesewing/plugin-annotations' + +export const plugins = { + 'plugin-annotations': annotations, +} diff --git a/sites/shared/prebuild/i18n.mjs b/sites/shared/prebuild/i18n.mjs index 05073da820d..7ba3234b931 100644 --- a/sites/shared/prebuild/i18n.mjs +++ b/sites/shared/prebuild/i18n.mjs @@ -5,6 +5,7 @@ import yaml from 'js-yaml' import { fileURLToPath } from 'url' import allLanguages from '../../../config/languages.json' assert { type: 'json' } import { designs } from '../i18n/designs.mjs' +import { plugins } from '../i18n/plugins.mjs' /* * This is where we configure what folders we should check for @@ -209,6 +210,19 @@ export const prebuildI18n = async (store) => { } for (const language of languages) writeJson(store.site, language, 'designs', designNs[language]) + /* + * Handle plugin translations + */ + const pluginNs = {} + for (const plugin in plugins) { + for (const language of languages) { + if (typeof pluginNs[language] === 'undefined') pluginNs[language] = {} + // Write out plugin namespace files + writeJson(store.site, language, plugin, plugins[plugin][language]) + } + } + for (const language of languages) writeJson(store.site, language, 'plugins', pluginNs[language]) + /* * Update the store */