Deploying to Production (5m)
Let's deploy your react app with GT.
Overview
This is a short tutorial to help you deploy your react app with GT.
We will do this in 3 steps:
Add your production API keys.
Share your configuration with your app.
Add the translate command to your build script.
Prerequisites
Make sure that you have followed the Quick Start Guide to set up your react app with GT.
Step 1: Switch to your production API keys 🔑
Add your production API key and Project ID to your production environment variables.
From your dashboard, go to API Keys in the sidebar. Click on Create API Key, and add them to your production envrionment.
Protect Your API Keys!
Production keys should only ever be used in production. Likewise, development keys should only ever be used in development. Never commit your API keys to a public repository!
Step 2: Share your configuration with your app ⚙️
The translate command will generate a configuration file in the root.
Pass the config file to <GTProvider>
.
If you have specified any locales in your provider, remove them.
The configuration file will take care of that.
Step 3: Add the translate command to your build script 🏗️
The last step is to add the translate command to your build script. Make sure that the translate command comes before the build command.
Specify the locales that you would like to ship to production.
Here, we have added French and Chinese to our configuration.
That's it! You are now ready to deploy your react app with GT!
Next steps
- Follow this guide on How to Manage Locales.
- Learn how to Translate Strings.
- Learn about the
<T>
component.