diff --git a/public/i18n/en_US.json b/public/i18n/en_US.json index 1513654..f08dd9d 100644 --- a/public/i18n/en_US.json +++ b/public/i18n/en_US.json @@ -2,15 +2,17 @@ "insertWhiteboard": "Insert whiteboard", "editWhiteboard": "Edit whiteboard", "editShortcut": "Edit selected whiteboard", - "errNoFileID": "File ID missing - couldn't open file.", - "errNotAWhiteboard": "You must select a whiteboard, not a regular image. Usage instructions", - "errSyncIDNotFound": "Couldn't find SyncID in document for drawing, make sure you're trying to edit a whiteboard that is included in at least a note.", - "errCreateUnknown": "Unknown error while creating editor, please try again.", - "errInvalidBackgroundColor": "Invalid background color! Please enter an HEX color, like #000000 (black) or #FFFFFF (white). The old background color will be used.", - "errMultipleSyncIDs": "Multiple syncIDs found in documents. Remove the drawings that don't exist from your documents.\n Sync conflict copies can cause this error, so make sure to delete them.\nFile IDs (the part you can change in the Rename menu) must be unique across all documents.\nFull explanation", - "errUnchangedProtyle": "Make sure the image you're trying to edit still exists in your documents.", - "errSaveGeneric": "Error saving! The current drawing has been copied to your clipboard. You may need to create a new drawing and paste it there.", - "errMustSelect": "Select a whiteboard in your document by left-clicking it, then use this icon/shortcut to open the editor directly. Usage instructions", + "errors": { + "noFileID": "File ID missing - couldn't open file.", + "notAWhiteboard": "You must select a whiteboard, not a regular image. Usage instructions", + "syncIDNotFound": "Couldn't find SyncID in document for drawing, make sure you're trying to edit a whiteboard that is included in at least a note.", + "createUnknown": "Unknown error while creating editor, please try again.", + "invalidBackgroundColor": "Invalid background color! Please enter an HEX color, like #000000 (black) or #FFFFFF (white). The old background color will be used.", + "multipleSyncIDs": "Multiple syncIDs found in documents. Remove the drawings that don't exist from your documents.\n Sync conflict copies can cause this error, so make sure to delete them.\nFile IDs (the part you can change in the Rename menu) must be unique across all documents.\nFull explanation", + "unchangedProtyle": "Make sure the image you're trying to edit still exists in your documents.", + "saveGeneric": "Error saving! The current drawing has been copied to your clipboard. You may need to create a new drawing and paste it there.", + "mustSelect": "Select a whiteboard in your document by left-clicking it, then use this icon/shortcut to open the editor directly. Usage instructions" + }, "whiteboard": "Whiteboard", "settings": { "name": "js-draw Plugin Settings", diff --git a/src/analytics.ts b/src/analytics.ts index 13d37be..127908c 100644 --- a/src/analytics.ts +++ b/src/analytics.ts @@ -24,6 +24,7 @@ export class Analytics { 'frontend': getFrontend(), 'backend': getBackend(), 'language': navigator.language, + 'appLanguage': window.siyuan.config.lang, } : {}; await fetch(Analytics.ENDPOINT, { diff --git a/src/editor.ts b/src/editor.ts index 8fbeefb..aeb032b 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -5,7 +5,7 @@ import Editor, { BackgroundComponentBackgroundType, BaseWidget, Color4, - EditorEventType, + EditorEventType, getLocalizationTable, Mat33, Vec2, Viewport @@ -45,6 +45,7 @@ export class PluginEditor { this.element = document.createElement("div"); this.element.style.height = '100%'; this.editor = new Editor(this.element, { + localization: getLocalizationTable([window.siyuan.config.lang]), iconProvider: new MaterialIconProvider(), }); diff --git a/src/errors.ts b/src/errors.ts index f7bf264..e135e53 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -21,7 +21,7 @@ export class ErrorReporter { console.error(err); let errorTxt = err.message; if(err instanceof InternationalizedError) { - errorTxt = ErrorReporter.i18n[err.key]; + errorTxt = ErrorReporter.i18n.errors[err.key]; } if(!timeout) { timeout = 0; @@ -33,48 +33,48 @@ export class ErrorReporter { export class SyncIDNotFoundError extends InternationalizedError { constructor() { - super('errSyncIDNotFound'); + super('syncIDNotFound'); } } export class UnchangedProtyleError extends InternationalizedError { constructor() { - super('errUnchangedProtyle'); + super('unchangedProtyle'); } } export class MultipleSyncIDsError extends InternationalizedError { constructor() { - super('errMultipleSyncIDs'); + super('multipleSyncIDs'); } } export class GenericSaveError extends InternationalizedError { constructor() { - super('errSaveGeneric'); + super('saveGeneric'); } } export class NotAWhiteboardError extends InternationalizedError { constructor() { - super('errNotAWhiteboard'); + super('notAWhiteboard'); } } export class InvalidBackgroundColorError extends InternationalizedError { constructor() { - super('errInvalidBackgroundColor'); + super('invalidBackgroundColor'); } } export class NoFileIDError extends InternationalizedError { constructor() { - super('errNoFileID'); + super('noFileID'); } } export class MustSelectError extends InternationalizedError { constructor() { - super('errMustSelect'); + super('mustSelect'); } } \ No newline at end of file