#2065 Add option to translate text before classification

This commit is contained in:
Cohee
2024-04-11 22:09:05 +03:00
parent 210f388d7a
commit 6290dff3d9
3 changed files with 14 additions and 0 deletions

View File

@ -977,6 +977,10 @@ async function getExpressionLabel(text) {
return getFallbackExpression();
}
if (extension_settings.expressions.translate && typeof window['translate'] === 'function') {
text = await window['translate'](text, 'en');
}
text = sampleClassifyText(text);
try {
@ -1717,6 +1721,10 @@ async function fetchImagesNoCache() {
$('#expressions_show_default').on('input', onExpressionsShowDefaultInput);
$('#expression_upload_pack_button').on('click', onClickExpressionUploadPackButton);
$('#expressions_show_default').prop('checked', extension_settings.expressions.showDefault).trigger('input');
$('#expression_translate').prop('checked', extension_settings.expressions.translate).on('input', function () {
extension_settings.expressions.translate = !!$(this).prop('checked');
saveSettingsDebounced();
});
$('#expression_local').prop('checked', extension_settings.expressions.local).on('input', function () {
extension_settings.expressions.local = !!$(this).prop('checked');
moduleWorker();