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
|
@ -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