fix: update translation labels to include stripping 'thinking' context #1222
+11
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Similar to Release v2.2.6 (b29645f), this PR helps people does not know how to use Regex and just simply get rid of thinking tag.
This pull request introduces changes to enhance the handling of translation results by stripping both empty lines and "thinking" tags from text. Updates include modifications to localization files for multiple languages and improvements to the
stripEmptyLines
function in the codebase.Localization updates:
addon/locale/en-US/preferences.ftl
: Updated the label forpref-advanced-stripEmptyLines
to clarify that both empty lines and thinking content are stripped from translation results.addon/locale/it-IT/preferences.ftl
: Updated the Italian localization forpref-advanced-stripEmptyLines
to reflect the same clarification.addon/locale/zh-CN/preferences.ftl
: Updated the Chinese localization forpref-advanced-stripEmptyLines
to include the removal of thinking content.Code functionality enhancement:
src/utils/str.ts
: Enhanced thestripEmptyLines
function to strip<think>...</think>
tags and their content from text, in addition to normalizing line endings and removing empty lines.For example, when using

qwen3:32b
,Before:
After:

Note: The stripping process will be conducted after all responses have been received. Consequently, there will be a temporary display of the thinking context. Once the translation is received in full, the thinking tag will be deleted.
Test Build:
translate-for-zotero.xpi.zip