Cameleer

AWS Translate component

The aws2-translate component translates text between languages with Amazon Translate, with optional automatic source language detection.

Scheme: aws2-translate: · Crate: cameleer-cloud · Cargo feature: cloud · Consumer: no · Producer: yes · Apache Camel: AWS Translate

When to use it

  • Translate support replies or product texts into the customer's language.
  • Normalize incoming messages to one language before classification or an LLM call.
  • Apply custom terminologies (brand names, product terms) to every translation.

URI format

text
aws2-translate://label[?options]

Example

Translate replies into German:

yaml example: aws2-translate-replies
- route:
    id: translate-replies
    from:
      uri: "aws2-sqs://replies-en?region={{env:AWS_REGION:us-east-1}}"
      steps:
        - to: "aws2-translate://replies?region={{env:AWS_REGION:us-east-1}}&sourceLanguage=en&targetLanguage=de"
        - to: "aws2-sqs://replies-de?region={{env:AWS_REGION:us-east-1}}&autoCreateQueue=true"

The body text is translated; the body after the call is the translation.

Rust DSL

rust
ctx.add_routes(|b| {
    b.from("aws2-sqs://replies-en?region={{env:AWS_REGION:us-east-1}}")
        .to("aws2-translate://replies?region={{env:AWS_REGION:us-east-1}}&sourceLanguage=en&targetLanguage=de")
        .to("aws2-sqs://replies-de?region={{env:AWS_REGION:us-east-1}}&autoCreateQueue=true");
})?;

Options

Common AWS options (region, credentials, endpoint override, proxy) are listed in Cloud credentials.

optiondefaultdescription
operationtranslateTextThe only operation.
sourceLanguageSource language code.
targetLanguageTarget language code.
autodetectSourceLanguagefalseSend auto as the source language; the detected language is set in CamelAwsTranslateSourceLanguage.

Message headers

headerdirectiondescription
CamelAwsTranslateOperationinOverrides operation.
CamelAwsTranslateSourceLanguagein/outSource language (out: the detected one with auto-detection).
CamelAwsTranslateTargetLanguageinTarget language.
CamelAwsTranslateTerminologyNamesinCustom terminologies (list).

Run it with Docker

sh
docker run --rm -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \
  -v "$PWD:/routes:ro" pmsudhi/cameleer run /routes/translate.camel.yaml

Common questions

How do I translate into the language of each customer?

Set CamelAwsTranslateTargetLanguage per message (for example from a customer header) instead of the targetLanguage option.

What if I do not know the source language?

Set autodetectSourceLanguage=true.

Found a problem?

If something on this page doesn't match what Cameleer does, or you hit a bug while building with it, please help fix it, whether you are a person or a coding agent: open an issue that describes what you saw, then fork the repository, fix it, add or update a test, run cargo test --workspace, and open a pull request. CONTRIBUTING.md explains the ground rules.

Edit this page on GitHub