# Increase Amazon translate limit to ~10,000 characters

**URL:** https://meta.discourse.org/t/increase-amazon-translate-limit-to-10-000-characters/304579
**Category:** Feature
**Tags:** translator, completed
**Created:** [April 18, 2024, 9:41pm UTC](https://meta.discourse.org/t/increase-amazon-translate-limit-to-10-000-characters/304579 "2024-04-18T21:41:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![alanbchristie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alanbchristie/32/350958_2.png) [@alanbchristie](https://meta.discourse.org/u/alanbchristie)
#### Post date: [April 18, 2024, 9:41pm UTC](https://meta.discourse.org/t/increase-amazon-translate-limit-to-10-000-characters/304579/1 "2024-04-18T21:41:40Z")

</div>

Why have you limited the Amazon translation text size to 5,000 characters in the plug-in’s `amazon.rb`?

According to [Amazon](https://docs.aws.amazon.com/translate/latest/APIReference/API_TranslateText.html#) their API supports text that is up to 10,000 characters.

Is there any chance you can modify the `MAXLENGTH` in your `amazon.rb` to 10000 anytime soon, and modify values in any related code files? I suspect my translations are truncated unnecessarily.

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [April 18, 2024, 9:57pm UTC](https://meta.discourse.org/t/increase-amazon-translate-limit-to-10-000-characters/304579/2 "2024-04-18T21:57:44Z")

</div>

> [@alanbchristie](#):
>
> Why have you limited the Amazon translation text size to 5,000 characters in the plug-in’s `amazon.rb`?
> 
> According to [Amazon](https://docs.aws.amazon.com/translate/latest/APIReference/API_TranslateText.html#) their API supports text that is up to 10,000 characters.

Probably a safety thing, since that API doc also says:

> Depending on your character set, this may be fewer than 10,000 characters.

---

<div class="post-metadata">

### Author: ![alanbchristie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alanbchristie/32/350958_2.png) [@alanbchristie](https://meta.discourse.org/u/alanbchristie)
#### Post date: [April 19, 2024, 6:34am UTC](https://meta.discourse.org/t/increase-amazon-translate-limit-to-10-000-characters/304579/3 "2024-04-19T06:34:48Z")

</div>

Thanks.

> Depending on your character set, this may be fewer than 10,000 characters.

If that is the reason, why are the values for LibreTranslate and Google also 5000? Their limits _are_ 5000. So if 50% of the text capacity is stripped from Amazon why isn’t 50% (or 5,000 characters) stripped from these? (Stripping 5,000 characters off LibreTranslate makes no sense anyway - that would leave 0!).

If that is indeed the reason the logic is clearly a) not applied consistently and b) not documented.

Isn’t this more likely to be a cut-and-paste typo?

Regardless, taking 5,000 characters off the limit of one translator and not the others just doesn’t make sense. Why not permit the documented limit and handle any errors? You have to handle errors anyway.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 19, 2024, 9:54am UTC](https://meta.discourse.org/t/increase-amazon-translate-limit-to-10-000-characters/304579/5 "2024-04-19T09:54:44Z")

</div>

Thanks @alanbchristie, this will be fixed once this gets merged 👍

[https://github.com/discourse/discourse-translator/pull/137](https://github.com/discourse/discourse-translator/pull/137)

While at it I fixed the `truncate` method to work at the byte-level instead of the character-level since the API expect at most 10k bytes, not 10k characters.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 21, 2024, 2:01pm UTC](https://meta.discourse.org/t/increase-amazon-translate-limit-to-10-000-characters/304579/6 "2024-04-21T14:01:30Z")

</div>

This topic was automatically closed after 2 days. New replies are no longer allowed.
