mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Re OCR popup prompt when Tesseract is not enabled https://github.com/siyuan-note/siyuan/issues/15367
This commit is contained in:
parent
7787ac6e1d
commit
70741fffcc
15 changed files with 40 additions and 15 deletions
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "غدًا",
|
||||
"263": "التالي %d أيام",
|
||||
"264": "الحقل [%s] فارغ",
|
||||
"265": "خارج النطاق"
|
||||
"265": "خارج النطاق",
|
||||
"266": "Tesseract OCR غير مثبت أو غير مهيأ، يرجى الرجوع إلى دليل المستخدم - قسم ملفات الموارد لإجراء الإعداد"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Morgen",
|
||||
"263": "Nächste %d Tage",
|
||||
"264": "Das Feld [%s] ist leer",
|
||||
"265": "Außerhalb des Bereichs"
|
||||
"265": "Außerhalb des Bereichs",
|
||||
"266": "Tesseract OCR ist nicht installiert oder konfiguriert, bitte lesen Sie das Benutzerhandbuch - Abschnitt Ressourcen-Dateien zur Konfiguration"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Tomorrow",
|
||||
"263": "Next %d days",
|
||||
"264": "Field [%s] is empty",
|
||||
"265": "Out of range"
|
||||
"265": "Out of range",
|
||||
"266": "Tesseract OCR is not installed or configured, please refer to the User Guide - Assets section for configuration"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Mañana",
|
||||
"263": "Próximos %d días",
|
||||
"264": "El campo [%s] está vacío",
|
||||
"265": "Fuera de rango"
|
||||
"265": "Fuera de rango",
|
||||
"266": "Tesseract OCR no está instalado o configurado, consulte la Guía del Usuario - Sección de archivos de recursos para la configuración"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Demain",
|
||||
"263": "Les %d prochains jours",
|
||||
"264": "Le champ [%s] est vide",
|
||||
"265": "Hors de portée"
|
||||
"265": "Hors de portée",
|
||||
"266": "Tesseract OCR n'est pas installé ou configuré, veuillez consulter le Guide de l'utilisateur - Section des fichiers de ressources pour la configuration"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "מחר",
|
||||
"263": "ה-%d ימים הבאים",
|
||||
"264": "השדה [%s] ריק",
|
||||
"265": "מחוץ לטווח"
|
||||
"265": "מחוץ לטווח",
|
||||
"266": "Tesseract OCR לא הותקן או הוגדר, אנא עיין במדריך למשתמש - פרק קבצי משאבים לצורך הגדרה"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Domani",
|
||||
"263": "Prossimi %d giorni",
|
||||
"264": "Il campo [%s] è vuoto",
|
||||
"265": "Fuori intervallo"
|
||||
"265": "Fuori intervallo",
|
||||
"266": "Tesseract OCR non è installato o configurato, fare riferimento alla Guida utente - Sezione file di risorse per la configurazione"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "明日",
|
||||
"263": "次の %d 日間",
|
||||
"264": "フィールド [%s] の値が空です",
|
||||
"265": "範囲外"
|
||||
"265": "範囲外",
|
||||
"266": "Tesseract OCR がインストールされていないか、設定されていません。ユーザーガイド - リソースファイルセクションを参照して設定してください"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Jutro",
|
||||
"263": "Następne %d dni",
|
||||
"264": "Pole [%s] jest puste",
|
||||
"265": "Poza zakresem"
|
||||
"265": "Poza zakresem",
|
||||
"266": "Tesseract OCR nie jest zainstalowany lub skonfigurowany, zapoznaj się z Podręcznikiem użytkownika - Sekcja plików zasobów, aby skonfigurować"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Amanhã",
|
||||
"263": "Próximos %d dias",
|
||||
"264": "O campo [%s] está vazio",
|
||||
"265": "Fora do intervalo"
|
||||
"265": "Fora do intervalo",
|
||||
"266": "Tesseract OCR não está instalado ou configurado, consulte o Guia do Usuário - Seção de Arquivos de Recursos para configuração"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "Завтра",
|
||||
"263": "Следующие %d дней",
|
||||
"264": "Поле [%s] имеет пустое значение",
|
||||
"265": "Вне диапазона"
|
||||
"265": "Вне диапазона",
|
||||
"266": "Tesseract OCR не установлен или не настроен, пожалуйста, обратитесь к Руководству пользователя - Раздел ресурсов для настройки"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "明天",
|
||||
"263": "未來 %d 天",
|
||||
"264": "字段 [%s] 值為空",
|
||||
"265": "不在範圍內"
|
||||
"265": "不在範圍內",
|
||||
"266": "Tesseract OCR 未安裝或未配置,請參考 使用者指南-資料文件 章節進行配置"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,7 @@
|
|||
"262": "明天",
|
||||
"263": "未来 %d 天",
|
||||
"264": "字段 [%s] 值为空",
|
||||
"265": "不在范围内"
|
||||
"265": "不在范围内",
|
||||
"266": "Tesseract OCR 未安装或未配置,请参考 用户指南-资源文件 章节进行配置"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,14 @@ func ocr(c *gin.Context) {
|
|||
|
||||
path := arg["path"].(string)
|
||||
|
||||
ocrJSON := util.OcrAsset(path)
|
||||
ocrJSON, err := util.OcrAsset(path)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 7000}
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"text": util.GetOcrJsonText(ocrJSON),
|
||||
"ocrJSON": ocrJSON,
|
||||
|
|
|
|||
|
|
@ -149,7 +149,12 @@ func ExistsAssetText(asset string) (ret bool) {
|
|||
return
|
||||
}
|
||||
|
||||
func OcrAsset(asset string) (ret []map[string]interface{}) {
|
||||
func OcrAsset(asset string) (ret []map[string]interface{}, err error) {
|
||||
if !TesseractEnabled {
|
||||
err = fmt.Errorf(Langs[Lang][266])
|
||||
return
|
||||
}
|
||||
|
||||
assetsPath := GetDataAssetsAbsPath()
|
||||
assetAbsPath := strings.TrimPrefix(asset, "assets")
|
||||
assetAbsPath = filepath.Join(assetsPath, assetAbsPath)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue