Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

https://www.figma.com/file/iPlgvGgg0nRHCOCMxlsrIv/Translate-button-in-Review-section?type=design&node-id=0-1&mode=design&t=NnNE3y4KsIC875uy-0

PRD

Private (https://app.clickup.com/9003122396/docs/8ca1fpw-7922/8ca1fpw-35276)

API Blueprint

MethodURLRequestResponse
POST/translatetarget_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

BE PR: https://github.com/hungryhub-team/hh-server/pull/5456/files#diff-db843f6de0c93122c446a7b40fd6c7067491d812c9a8d79df7b5e04f125ea435


Improvement: