This is a Firebase and Google Cloud powered app used for demo purposes. It implements a "universal translator", where an Android client app records some speech, uploads it to Google Cloud, and receives translations in a variety of languages. A client web app also receives the translates and speaks them out loud using the browser's speech synthesis API.
This is a rewrite of Jen Tong's similar project.
At the top level, you'll find:
android
- Android app that receives speech and uploads it to Google Cloud for processingbackend
- TypeScript for Cloud Functions on the backendweb
- and the JS / HTML translation viewer
This setup assumes you are already familiar with how Firebase and Google Cloud projects work.
- Create a Firebase project in the Firebase console
- Go to the Authentication product tab and enable Google authentication.
- Go to the Database product tab and enable Cloud Firestore.
- Go to the Storage product tab and enable Cloud Storage.
- Enable Blaze plan billing on the project (required for the Google Cloud APIs used here)
- In the Cloud console for the same project, enable both the Cloud Translation API and the Cloud Speech-to-Text API.
- Install the Firebase CLI
- Clone this repo.
cd backend
firebase use --add
, then select the newly created project, and give it the alias "default"cd functions; npm install
to set up the Cloud Functions node project.firebase deploy
to deploy Cloud Functions code, Firestore security rules, and Cloud Storage security rules- Optional - if you want to run the scripts in
functions/dev
, download a service account and place it inservice-account-credentials.json
in thefunctions
folder.
cd web
firebase use --add
, then select the newly created project, and give it the alias "default"firebase deploy
to deploy the web app to Firebase Hosting- Note the given URL for the web site
cd android
- Add the app to your project in the Firebase console, and be sure to provide the SHA-1 of your debug signing key
- Download the
google-services.json
file for your project from the Firebase console, move it to theapp
folder ./gradlew assembleDebug
- Install the APK on your emulator or device
- Open the web app using the URL given after it was deployed (*.firebaseapp.com)
- Select the language in which you want to hear a translation
- Launch the Android app
- Select the language you want to translate from the dropdown
- Push the record button, speak in that language, then push the button again
- Wait for the translations to appear in both the Android app and the web app. The web app will also speak it out loud in the selected language
- Cloud Firestore
- Firebase Storage
- Cloud Functions for Firebase
- Firebase Hosting
- Cloud Speech-to-Text API
- Cloud Translation API
Please read and follow the steps in the CONTRIBUTING.md
The code in this project is licensed under the Apache License 2.0.
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This is not an officially supported Google product.