Improve editor localization, localization reporting, i18n separation
All checks were successful
Build on Push and create Release on Tag / build (push) Successful in 56s
All checks were successful
Build on Push and create Release on Tag / build (push) Successful in 56s
This commit is contained in:
parent
3874378824
commit
163a1513e8
4 changed files with 23 additions and 19 deletions
|
@ -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. <a href='https://s.massive.box/jsdraw-plugin-instructions'>Usage instructions</a>",
|
||||
"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.\n<a href='https://git.massive.box/massivebox/siyuan-jsdraw-plugin/wiki/Errors-and-Fixes#multiple-syncids-found'>Full explanation</a>",
|
||||
"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. <a href='https://s.massive.box/jsdraw-plugin-instructions'>Usage instructions</a>",
|
||||
"errors": {
|
||||
"noFileID": "File ID missing - couldn't open file.",
|
||||
"notAWhiteboard": "You must select a whiteboard, not a regular image. <a href='https://s.massive.box/jsdraw-plugin-instructions'>Usage instructions</a>",
|
||||
"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.\n<a href='https://git.massive.box/massivebox/siyuan-jsdraw-plugin/wiki/Errors-and-Fixes#multiple-syncids-found'>Full explanation</a>",
|
||||
"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. <a href='https://s.massive.box/jsdraw-plugin-instructions'>Usage instructions</a>"
|
||||
},
|
||||
"whiteboard": "Whiteboard",
|
||||
"settings": {
|
||||
"name": "js-draw Plugin Settings",
|
||||
|
|
|
@ -24,6 +24,7 @@ export class Analytics {
|
|||
'frontend': getFrontend(),
|
||||
'backend': getBackend(),
|
||||
'language': navigator.language,
|
||||
'appLanguage': window.siyuan.config.lang,
|
||||
} : {};
|
||||
|
||||
await fetch(Analytics.ENDPOINT, {
|
||||
|
|
|
@ -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(),
|
||||
});
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue