Add types for global translation function

This commit is contained in:
Cohee
2025-02-19 22:18:09 +02:00
parent c12f26441e
commit 58bbfc0d4e
4 changed files with 13 additions and 5 deletions

View File

@ -929,8 +929,8 @@ export async function getExpressionLabel(text, expressionsApi = extension_settin
return extension_settings.expressions.fallback_expression;
}
if (extension_settings.expressions.translate && typeof window['translate'] === 'function') {
text = await window['translate'](text, 'en');
if (extension_settings.expressions.translate && typeof globalThis.translate === 'function') {
text = await globalThis.translate(text, 'en');
}
text = sampleClassifyText(text);