diff --git a/public/i18n/en_US.json b/public/i18n/en_US.json
index b6d2382..88c96a3 100644
--- a/public/i18n/en_US.json
+++ b/public/i18n/en_US.json
@@ -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).
The editor will always open as a dialog on mobile."
+ },
+ "analytics": {
+ "title": "Analytics",
+ "description": "Enable to send anonymous usage data to the developer. Privacy Policy"
+ }
+ }
}
\ No newline at end of file
diff --git a/src/config.ts b/src/config.ts
index 52fd764..4491329 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -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).
- 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.
- Privacy
- `,
+ title: this.plugin.i18n.settings.analytics.title,
+ description: this.plugin.i18n.settings.analytics.description,
value: this.config.options.analytics,
type: 'checkbox'
});
diff --git a/src/editor.ts b/src/editor.ts
index 8680a40..d8bb16e 100644
--- a/src/editor.ts
+++ b/src/editor.ts
@@ -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: {
diff --git a/src/index.ts b/src/index.ts
index 599bf3a..1ef36aa 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -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);