# AI translate option translates wrong text

**URL:** https://meta.discourse.org/t/ai-translate-option-translates-wrong-text/283951
**Category:** Bug
**Tags:** ai, ai-helper
**Created:** [October 30, 2023, 10:12pm UTC](https://meta.discourse.org/t/ai-translate-option-translates-wrong-text/283951 "2023-10-30T22:12:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [October 30, 2023, 10:12pm UTC](https://meta.discourse.org/t/ai-translate-option-translates-wrong-text/283951/1 "2023-10-30T22:12:39Z")

</div>

Although I selected the sentence at the bottom, the translator translates the text in the second line.

![Translates wrong text](https://global.discourse-cdn.com/meta/original/4X/7/8/7/78772aa4d0fdece591f19e94bb14d7f6f49895ed.gif)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [October 30, 2023, 10:49pm UTC](https://meta.discourse.org/t/ai-translate-option-translates-wrong-text/283951/2 "2023-10-30T22:49:02Z")

</div>

It translates the first match of the whole sentence, I see.

I’m afraid this is yet another pitfall of our textarea based composer, problems like this requires hacks to be able to track and replace the Nth occurrence.

@keegan can you add this to your list? Low priority tho.

---

<div class="post-metadata">

### Author: ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)
#### Post date: [December 20, 2023, 7:25pm UTC](https://meta.discourse.org/t/ai-translate-option-translates-wrong-text/283951/3 "2023-12-20T19:25:57Z")

</div>

While [fixing another issue](https://github.com/discourse/discourse-ai/pull/372), this is also now resolved since the insertion takes into account the selection range now 🎉

---

<div class="post-metadata">

### Author: ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)
#### Post date: [December 21, 2023, 4:00pm UTC](https://meta.discourse.org/t/ai-translate-option-translates-wrong-text/283951/4 "2023-12-21T16:00:44Z")

</div>

This topic was automatically closed after 20 hours. New replies are no longer allowed.
