Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/plugins/translate/plugin.translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ export class BrTranslatePanel extends LitElement {
}

_toggleTranslation(event) {
// Prevent translating when source and target are identical
if (this.detectedFromLang === this.detectedToLang) {
Comment on lines +483 to +484
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new same-language guard runs unconditionally, which also blocks turning translation off if the user is currently translating and then changes the From/To dropdowns to the same language. In that state the button reads "Stop Translating", but clicking it will only alert and return, leaving translation stuck on. Consider only preventing the toggle when starting translation (e.g., when !this.userTranslationActive) or otherwise allow the stop action even if languages match.

Suggested change
// Prevent translating when source and target are identical
if (this.detectedFromLang === this.detectedToLang) {
// Prevent starting translation when source and target are identical
if (!this.userTranslationActive && this.detectedFromLang === this.detectedToLang) {

Copilot uses AI. Check for mistakes.
alert('You cannot translate to/from the same language');
return;
}
const toggleTranslateEvent = new CustomEvent('toggleTranslation', {
detail: {value: event.target.value},
bubbles: true,
Expand All @@ -491,9 +496,6 @@ export class BrTranslatePanel extends LitElement {

// TODO: Hardcoded warning message for now but should add more statuses
_statusWarning() {
if (this.detectedFromLang == this.detectedToLang) {
return "Translate To language is the same as the Source language";
}
return "";
}

Expand Down
Loading