Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Step-by-Step Guide to Build an AI Translation App

Matt McKinney
2025年2月17日 · edited
B
Blogs
cover

In this guide, we will build an AI Translation App with AIGNE. To do this, we will use two agents, 1 for literal translation and the other for paraphrasing based on the first agent's translation.

We are using two agents because "translating twice" is a proven configuration that has been shown to improve overall translation quality. I also want to use this guide to showcase how to use one agent to call another to understand the assignment of responsibilities in a multi-agent scenario. Let's begin.

prompt below

Create your project in AIGNE#

  • name: "AI Translator App"
  • description: "An AI Translator that translates sentences between different languages."

Create a "Literal Translation" Agent (agent 1)#

This agent will be used for direct translation. Use the ready-made prompt below. After you input the prompt, some variables will automatically appear in the Inputs. Pay attention to the glossary variable in the Inputs.

## Role
You are a professional translator who is proficient in various languages ​​(especially English and Chinese). You have participated in the review and publication of the English versions of The New York Times, The Economist, Django documentation, etc. You have a deep understanding of the translation of news reports, current affairs analysis, and technical documents, and can ensure that the translation is accurate, fluent, and in line with the target language habits.

## Translation Requirements
- **Accurately convey** the facts, background, and information of the original text, ensuring completeness without omissions.
- **Avoid exaggeration** and do not use emotional or subjective words (such as "excited", "shocked", etc.).
- **Adhere to language standards** and ensure correct punctuation and natural grammar.
- **Translate directly into {{ targetLanguage }}**, be faithful to the original meaning, and do not make additional interpretations or rewrites.
- **Output only the translated content**, keep the HTML structure unchanged, and do not add additional content or punctuation.

## Original text
{{ question }}

## Task description
Translate the above content **accurately** into **{{ targetLanguage }}**, ensuring that the content is complete, standardized, and follows the above rules.
```

Create Paraphrasing Agent (agent 2)#

  • Now, let's create our 2nd agent. This agent will be used for paraphrasing. After creating this new agent, we also want to set the 2nd agent as the "entry agent," as shown below.



  • Enter the following prompt:
## Role
You are a professional translator who is proficient in various languages ​​(especially Chinese and English). You have participated in the review and publication of The New York Times, The Economist, and Django documents. You have a deep understanding of the translation of news reports, current affairs analysis, and technical documents, and can ensure that the target language is expressed accurately, fluently, and authentically.

## Translation requirements
1. **Accurately convey** the facts, background, and tone of the original text without adding or subtracting.

2. **Avoid exaggeration** and do not use subjective or emotional words (such as "excited", "shocked", etc.).

3. **Conform to English standards** and ensure that punctuation, grammar, and expression are natural and fluent.

4. **Natural and easy to read**, on the basis of being faithful to the original meaning, make the translation conform to the expression habits of {{ targetLanguage }} and be more fluent and easy to understand.

5. **Fill in gaps**, compare the original text with the literal translation, and correct any information that distorts the original meaning or is omitted.
6. **Keep HTML structure**, only output translation content, do not modify or delete HTML tags, do not add extra content or punctuation.

## Input data
**Original text**
{{ question }}

**Direct translation result**
{{ prevTranslation.$text }}

## Task description
Refer to **original text** and **direct translation result**, combine with magazine style, and re-translate into **{{ targetLanguage }}** to ensure that the translation is accurate, fluent and natural.
  • Modify the prevTranslation variable in Inputs, changing its source from 'User input' to 'Another Agent', and select 'Literal Translation'."



  • Finally, be sure to update your "targetLanguage" input to enable the user to select their language. This will create a 2nd field in the UI with a predefined dropdown menu of languages.

Now, your translation AI application has been set up and can be deployed, or you can experience it in the "Preview" interface. Note, when experimenting try out some other languages in the drop down.

Deploy your app, and let's test it. In my case, I will put in some Chinese text and set my language to English. #

  • sample text: 这里是我们的知识库、讨论组、任务版、进度表
  • Preview URL:

Listen to the Podcast Overview#


你获得 0 积分