Notify on auto language detection
All checks were successful
Build on Push and create Release on Tag / build (push) Successful in 47s

This commit is contained in:
MassiveBox 2025-12-04 21:42:17 +01:00
parent 68025b9a34
commit f26a123d1e
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
3 changed files with 18 additions and 2 deletions

View file

@ -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.<br>If enabled, language options are overridden by \"Offline dictionaries\"."
},
"offlineDicts": {
"title": "Offline dictionaries",
"description": "Comma-separated list of dictionaries used for offline spell checking. <a href='https://github.com/wooorm/dictionaries/tree/main/dictionaries'>Available options</a>. Example: <code>en,it</code><br>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. <small>Suggestions can be auto-applied when selected. Visit the plugin's settings to enable.</small>",
"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.<br>You can set the default language in plugin settings, or document-wise through Doc Tree > Plugin > SySpell.<br><small>You can disable this warning in the plugin settings.</small>"
},
"docMenu": {
"documentStatus": "Document status",

View file

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

View file

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