Skip to content

Commit 21b16bf

Browse files
authored
feat: do not display hint with untranslated content (#14)
1 parent cddddc5 commit 21b16bf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/controller/immersive.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ export function RegisterTranslator(ctx: Context) {
6060
if (!translatedText)
6161
continue
6262

63+
// Skip if the translated text is the same as input
64+
if (
65+
translatedText.toLowerCase() === phrase.toLowerCase()
66+
|| translatedText.toLowerCase() === match[0].toLowerCase()
67+
)
68+
continue
69+
6370
const startPos = editor.document.positionAt(match.index)
6471
const endPos = editor.document.positionAt(match.index + phrase.length)
6572
const range = new Range(startPos, endPos)

0 commit comments

Comments
 (0)