Start workin on i18n
This commit is contained in:
parent
3a05d36f8c
commit
f35342a791
4 changed files with 35 additions and 18 deletions
|
@ -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>"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -87,6 +87,7 @@ export class PluginConfigViewer {
|
||||||
|
|
||||||
this.settingUtils = new SettingUtils({
|
this.settingUtils = new SettingUtils({
|
||||||
plugin: this.plugin,
|
plugin: this.plugin,
|
||||||
|
name: this.plugin.i18n.settings.name,
|
||||||
callback: async (data) => {
|
callback: async (data) => {
|
||||||
this.config.setConfig({
|
this.config.setConfig({
|
||||||
grid: data.grid,
|
grid: data.grid,
|
||||||
|
@ -100,38 +101,32 @@ export class PluginConfigViewer {
|
||||||
|
|
||||||
this.settingUtils.addItem({
|
this.settingUtils.addItem({
|
||||||
key: "grid",
|
key: "grid",
|
||||||
title: "Enable grid by default",
|
title: this.plugin.i18n.settings.grid.title,
|
||||||
description: "Enable to automatically turn on the grid on new drawings.",
|
description: this.plugin.i18n.settings.grid.description,
|
||||||
value: this.config.options.grid,
|
value: this.config.options.grid,
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.settingUtils.addItem({
|
this.settingUtils.addItem({
|
||||||
key: "background",
|
key: "background",
|
||||||
title: "Default background Color",
|
title: this.plugin.i18n.settings.background.title,
|
||||||
description: "Default background color of the drawing area for new drawings in hexadecimal.",
|
description: this.plugin.i18n.settings.background.description,
|
||||||
value: this.config.options.background,
|
value: this.config.options.background,
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
});
|
});
|
||||||
|
|
||||||
this.settingUtils.addItem({
|
this.settingUtils.addItem({
|
||||||
key: "dialogOnDesktop",
|
key: "dialogOnDesktop",
|
||||||
title: "Open editor as dialog on desktop",
|
title: this.plugin.i18n.settings.dialogOnDesktop.title,
|
||||||
description: `
|
description: this.plugin.i18n.settings.dialogOnDesktop.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.
|
|
||||||
`,
|
|
||||||
value: this.config.options.dialogOnDesktop,
|
value: this.config.options.dialogOnDesktop,
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.settingUtils.addItem({
|
this.settingUtils.addItem({
|
||||||
key: "analytics",
|
key: "analytics",
|
||||||
title: "Analytics",
|
title: this.plugin.i18n.settings.analytics.title,
|
||||||
description: `
|
description: this.plugin.i18n.settings.analytics.description,
|
||||||
Enable to send anonymous usage data to the developer.
|
|
||||||
<a href='https://s.massive.box/jsdraw-plugin-privacy'>Privacy</a>
|
|
||||||
`,
|
|
||||||
value: this.config.options.analytics,
|
value: this.config.options.analytics,
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
});
|
});
|
||||||
|
|
|
@ -144,7 +144,7 @@ export class EditorManager {
|
||||||
init() {
|
init() {
|
||||||
const fileID = this.data.fileID;
|
const fileID = this.data.fileID;
|
||||||
if (fileID == null) {
|
if (fileID == null) {
|
||||||
alert("File ID missing - couldn't open file.")
|
alert(p.i18n.errNoFileID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const editor = new PluginEditor(fileID, p.config.getDefaultEditorOptions());
|
const editor = new PluginEditor(fileID, p.config.getDefaultEditorOptions());
|
||||||
|
@ -157,7 +157,7 @@ export class EditorManager {
|
||||||
openTab({
|
openTab({
|
||||||
app: p.app,
|
app: p.app,
|
||||||
custom: {
|
custom: {
|
||||||
title: 'Drawing',
|
title: p.i18n.drawing,
|
||||||
icon: 'iconDraw',
|
icon: 'iconDraw',
|
||||||
id: "siyuan-jsdraw-pluginwhiteboard",
|
id: "siyuan-jsdraw-pluginwhiteboard",
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -43,7 +43,7 @@ export default class DrawJSPlugin extends Plugin {
|
||||||
if (ids === null) return;
|
if (ids === null) return;
|
||||||
e.detail.menu.addItem({
|
e.detail.menu.addItem({
|
||||||
icon: "iconDraw",
|
icon: "iconDraw",
|
||||||
label: "Edit with js-draw",
|
label: this.i18n.editDrawing,
|
||||||
click: () => {
|
click: () => {
|
||||||
void this.analytics.sendEvent('edit');
|
void this.analytics.sendEvent('edit');
|
||||||
new EditorManager(ids.fileID, this.config.getDefaultEditorOptions()).open(this);
|
new EditorManager(ids.fileID, this.config.getDefaultEditorOptions()).open(this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue