Skip to content

takakd/retranslate

Repository files navigation

Retranslate

Retranslate text with Google Translation and Amazon Translate.

License-MIT


Table of Contents

Features

  • Translate text with Google Translation API and Amazon Translate API.
  • Translate translated text again.

Usage

Select a source language and enter text, and this app will translate them after a while.

Development

Tech stacks

  • TypeScript, Node.js
  • React, Next.js
  • gRPC WEB

Setup

Requirements

  • macOS 10.15.5
  • Node.js v14.15.3, npm 6.14.9

We tested in the above environment.

Install npm modules

$ npm install

Set environment variables

Set environment variables. For details, to see .env.example.

npm commands

Command details
dev Run on development mode
build Build app for production
start Run on production mode
type-check tsc checks .ts types
format Format codes
lint Lint codes
test Run lint, type-check, test-snap, and tests
test-snap Update jest snapshots

Structure

Sources

.
|-- .env.local          <-- Environment variables on local
|-- .github             <-- Deployment GitHub action
|-- README.next.md          <-- Next.js readme
|
|-- api                     <-- API classes
|   `-- translator.ts
|
|-- components                  <-- React components
|   |-- github-corner.tsx       <-- Google Analytics Tag
|   |-- google-analytics.tsx    <-- GitHub corner icon
|   |-- lang-select.tsx         <-- Language selection dropdown
|   |-- service-image.tsx       <-- Translation service image
|   `-- text-box.tsx            <-- Text box
|
|-- grpc                    <-- Auto generated gRPC classes
|-- next-env.d.ts           <-- Ensuring Next.js types for TypeScript
|-- pages           <-- Next.js pages
|   |-- _app.tsx
|   `-- index.tsx   <-- Home page
|
|-- public          <-- Logo images
|   |-- favicon.png
|   |-- logo-aws.png
|   `-- logo-google.png
|
|-- scripts
|   `-- proto      <-- Script to generate gRPC classes with .proto
|
|-- static.json     <-- heroku-buildpack-static config to deploy to Heroku
|
`-- test        <-- jest tests files

proto

This app uses Translation gRPC API and needs JavaScript codes generated by proto definitions. Generate codes by the below commands:

$ ./scripts/proto /Somewhere/api/protos

Get in touch

Contributing

Issues and reviews are welcome. Don't hesitate to create issues and PR.

License

© 2021 takakd