Translate Review Button
Description / Background
The Language Translation Feature aims to facilitate communication between reviewers and users by enabling the translation of non-native languages used in reviews to the language set on the website. This feature will enhance user experience and comprehension, especially in multilingual environments where the website supports languages like English and Thai.
Glossary
- Language that user pick was from here:
or 
Objectives
- User can see the "Translate this" text on reviews, if the review language is different from the language that user pick.
\
- User can see the "See original" text on reviews, after they click "Translate this" to turn the review back to their original language

- User cannot see the "Translate this" text if the review language same as the language that user pick

Scope
All Platform
Sequence Diagram / Flow

ERD
Backend Implementation
- Add AWS Translate ENV
AWS_TRANSLATE_REGION=us-east-1
AWS_TRANSLATE_ACCESS_KEY_ID=xxx
AWS_TRANSLATE_SECRET_KEY=xxx
- Add Transaction Helper
module AwsTranslationHelper
def aws_translate_client
Aws::Translate::Client.new(
region: Figaro.env.AWS_TRANSLATE_REGION!,
access_key_id: Figaro.env.AWS_TRANSLATE_ACCESS_KEY_ID!,
secret_access_key: Figaro.env.AWS_TRANSLATE_SECRET_KEY!,
)
end
end
Frontend Implementation
- If user language TH and the review response from BE was alphabetical then show translate button (isShowReadMore)
- If user language EN and the review response from BE was non-alphabetical then show translate button (isShowReadMore)
- When user click translate button (onTranslateClicked), hit endpoint POST /translate, and show the response
- After user click "translate this" it will show "see original" button
Design
PRD
Private (https://app.clickup.com/9003122396/docs/8ca1fpw-7922/8ca1fpw-35276)
API Blueprint
| Method | URL | Request | Response |
|---|---|---|---|
| POST | /translate | target_language_code, review (object) | review (object) |
Task
Private (https://app.clickup.com/t/860qzmt7q) FE PR: https://github.com/hungryhub-team/hh-nuxt/pull/992/files