Skip to content

TypeScript / Node / Express web app to translate documents and export translation

Notifications You must be signed in to change notification settings

Lstedmanfalls/translateDocument

Repository files navigation

Backstory:

A colleague at work needed help getting pertinent information out of a 23 page .pdf manual that was written in German.

To translate the manual into English, he was manually copying and pasting blocks of text from it into Google Translate web text input box. Google translate only allows a maximum of 3900 characters at once, so translating the entire manual would've taken quite a bit of time and effort.

Functionality:

This app will allow a user to upload a document written in one language and download a translated version of it in another language

Running Locally:

  1. Create a Google Cloud project linked to a service account that has access to Cloud Translation API
  1. Set PROJECT_ID env variable in .env file
  • PROJECT_ID="{project_id}"
  1. Set auth env variable in console to point to locally stored service account pem. Will need to set for each new terminal session.
  • export GOOGLE_APPLICATION_CREDENTIALS="{path_to_key}"
  1. Install this project's dependencies
  • npm i
  1. Run the server locally without needing to compile to js
  • npx tsx app.ts

TO DO Still:

  • Add ability to translate from a word document as well
  • Add a frontend that lets a user upload a document via a form, displays the translated page count, lets the user select the start and end page with num picker, and lets the user download the translated word doc
  • Finish writing unit tests for services

About

TypeScript / Node / Express web app to translate documents and export translation

Topics

Resources

Stars

Watchers

Forks