diff --git a/public/i18n/en_US.json b/public/i18n/en_US.json index ab4e6f6..ad5b771 100644 --- a/public/i18n/en_US.json +++ b/public/i18n/en_US.json @@ -51,11 +51,15 @@ }, "offline": { "title": "Offline mode", - "description": "If enabled, the plugin will use a local spell checker, which is more privacy friendly and works without internet, but doesn't provide advanced grammar checking and may slow SiYuan down when a large note is being loaded." + "description": "If enabled, the plugin will use a local spell checker, which is more privacy friendly and works without internet, but doesn't provide advanced grammar checking.
If enabled, language options are overridden by \"Offline dictionaries\"." }, "offlineDicts": { "title": "Offline dictionaries", "description": "Comma-separated list of dictionaries used for offline spell checking. Available options. Example: en,it
Set your primary language as first, and don't include unneeded languages, as they will only use more resources." + }, + "reportAuto": { + "title": "Notify if document language is auto", + "description": "Using language auto-detection is not recommended. If enabled, the system will notify you when a document's language is set to auto." } }, "errors": { @@ -66,7 +70,8 @@ "correctionNotEnabled": "The correction has been copied to your clipboard. Suggestions can be auto-applied when selected. Visit the plugin's settings to enable.", "checkServer": "Failed to contact grammar checking server, make sure it's correctly set or enable Offline Mode in the plugin settings.", "notImplementedNotebookSettings": "Notebook-wide grammar checking settings aren't implemented yet, they will be added in a future version. Thanks for your patience!", - "hunspellLoadError": "Failed loading offline spell checker: " + "hunspellLoadError": "Failed loading offline spell checker: ", + "autoLanguage": "The language for this document is set to \"auto\", which is not recommended.
You can set the default language in plugin settings, or document-wise through Doc Tree > Plugin > SySpell.
You can disable this warning in the plugin settings." }, "docMenu": { "documentStatus": "Document status", diff --git a/src/index.ts b/src/index.ts index 3abd45c..7f4c609 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,6 +85,9 @@ export default class SpellCheckPlugin extends Plugin { void this.suggestions.forAllBlocksSuggest(false, true) const settings = await ProtyleHelper.getDocumentSettings(event.detail.protyle.block.id, this.settingsUtil.get('enabledByDefault'), this.settingsUtil.get('defaultLanguage')) + if(settings.language == 'auto' && this.settingsUtil.get('online')) { + showMessage(this.i18nx.errors.autoLanguage, -1, 'info') + } this.currentlyEditing = { protyle: new ProtyleHelper(event.detail.protyle.contentElement), enabled: settings.enabled, diff --git a/src/settings.ts b/src/settings.ts index 4503e53..8340373 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -109,6 +109,14 @@ export class Settings { value: 'auto' }) + su.addItem({ + type: 'checkbox', + key: 'reportAuto', + title: to.reportAuto.title, + description: to.reportAuto.description, + value: true + }) + su.addItem({ type: 'checkbox', key: 'offline',