Start workin on i18n

This commit is contained in:
MassiveBox 2025-04-20 22:16:48 +02:00
parent 3a05d36f8c
commit f35342a791
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
4 changed files with 35 additions and 18 deletions

View file

@ -1,3 +1,25 @@
{
"insertDrawing": "Insert Drawing"
"insertDrawing": "Insert Drawing",
"editDrawing": "Edit with js-draw",
"errNoFileID": "File ID missing - couldn't open file.",
"drawing": "Drawing",
"settings": {
"name": "js-draw Plugin Settings",
"grid": {
"title": "Enable grid by default",
"description": "Enable to automatically turn on the grid on new drawings."
},
"background": {
"title": "Default background Color",
"description": "Default background color for new drawings, in hexadecimal."
},
"dialogOnDesktop": {
"title": "Open editor as dialog on desktop",
"description": "Dialog mode provides a larger drawing area, but it's not as handy to use as tabs (default).<br />The editor will always open as a dialog on mobile."
},
"analytics": {
"title": "Analytics",
"description": "Enable to send anonymous usage data to the developer. <a href='https://s.massive.box/jsdraw-plugin-privacy'>Privacy Policy</a>"
}
}
}

View file

@ -87,6 +87,7 @@ export class PluginConfigViewer {
this.settingUtils = new SettingUtils({
plugin: this.plugin,
name: this.plugin.i18n.settings.name,
callback: async (data) => {
this.config.setConfig({
grid: data.grid,
@ -100,38 +101,32 @@ export class PluginConfigViewer {
this.settingUtils.addItem({
key: "grid",
title: "Enable grid by default",
description: "Enable to automatically turn on the grid on new drawings.",
title: this.plugin.i18n.settings.grid.title,
description: this.plugin.i18n.settings.grid.description,
value: this.config.options.grid,
type: 'checkbox'
});
this.settingUtils.addItem({
key: "background",
title: "Default background Color",
description: "Default background color of the drawing area for new drawings in hexadecimal.",
title: this.plugin.i18n.settings.background.title,
description: this.plugin.i18n.settings.background.description,
value: this.config.options.background,
type: 'textarea',
});
this.settingUtils.addItem({
key: "dialogOnDesktop",
title: "Open editor as dialog on desktop",
description: `
Dialog mode provides a larger drawing area, but it's not as handy to use as tabs (default).<br />
The editor will always open as a dialog on mobile.
`,
title: this.plugin.i18n.settings.dialogOnDesktop.title,
description: this.plugin.i18n.settings.dialogOnDesktop.description,
value: this.config.options.dialogOnDesktop,
type: 'checkbox'
});
this.settingUtils.addItem({
key: "analytics",
title: "Analytics",
description: `
Enable to send anonymous usage data to the developer.
<a href='https://s.massive.box/jsdraw-plugin-privacy'>Privacy</a>
`,
title: this.plugin.i18n.settings.analytics.title,
description: this.plugin.i18n.settings.analytics.description,
value: this.config.options.analytics,
type: 'checkbox'
});

View file

@ -144,7 +144,7 @@ export class EditorManager {
init() {
const fileID = this.data.fileID;
if (fileID == null) {
alert("File ID missing - couldn't open file.")
alert(p.i18n.errNoFileID);
return;
}
const editor = new PluginEditor(fileID, p.config.getDefaultEditorOptions());
@ -157,7 +157,7 @@ export class EditorManager {
openTab({
app: p.app,
custom: {
title: 'Drawing',
title: p.i18n.drawing,
icon: 'iconDraw',
id: "siyuan-jsdraw-pluginwhiteboard",
data: {

View file

@ -43,7 +43,7 @@ export default class DrawJSPlugin extends Plugin {
if (ids === null) return;
e.detail.menu.addItem({
icon: "iconDraw",
label: "Edit with js-draw",
label: this.i18n.editDrawing,
click: () => {
void this.analytics.sendEvent('edit');
new EditorManager(ids.fileID, this.config.getDefaultEditorOptions()).open(this);