Quickstart
Get started translating your product in minutes.
Create a Quetzal Project
First, sign up for Quetzal here.
You will then be prompted to create a New Quetzal Project.
Install Quetzal
Once your project is created, install our npm package to set up your Node.js project with Quetzal.
npm install --save @quetzallabs/i18n
npm install --save @quetzallabs/i18n
npm install --save @quetzallabs/i18n-react-native
Don’t see an option that works for you? Contact Us if you are unsure of how to set up Quetzal with your stack
After installing, run the setup script:
This script will do the following:
- Makes a change to your
.env
file so you can add your Quetzal API Key - Adds a template
quetzal.config.json
file for you to edit - Adds our locale detector (
i18n.ts
) in your project root which detect’s the user’s locale for use withnext-intl
- Adds a “prebuild” script to your
package.json
so that we can get all your strings before a build and either get the existing translations or translate new strings.
Next-Intl Setup
Quetzal is built on next-intl for Next.js apps and use-intl for React apps.
As such, you must update your app to use the NextIntlClientProvider
or IntlProvider
.
For Next projects, you also must include the createNextIntlPlugin
in your next config file. This process is documented by next-intl.
Optional: Install VSCode/Cursor Extension
To dramatically speed up integration throughout your app, install the Quetzal VSCode Extension
Continue setting up your project
As mentioned above, you should do the following before continuing:
- Update your
.env
file with yourQUETZAL_API_KEY
found in the dashboard from the previous step. (If you used the setup script, this will already be added for you!) - Modify the
quetzal.config.json
specifying which folders to scrape fort
-wrapped strings. - Update
next.config.js
ornext.config.mjs
to add thenext-intl
plugin to your project:
next.config.js
next.config.mjs
- Add the
next-intl
provider to yourlayout.tsx
, like so:
Usage
Now you can use the t
function from either the hook or the awaitable function like so:
Async/Server Components
Client Components
See more information about how to use the t
function here.
Wrapping Strings for Translation
To find the strings to translate, you can use our VSCode Extension to find all of your user-facing strings. This extension was installed as a part of the setup script. To use it:
- Open VSCode
- Press Cmd+Shift+P
- Type “Quetzal” and find “Quetzal: Scan for user-facing strings”
- Select filetypes and folders to scan for strings
- Now you can see every file that has user-facing strings and easily wrap them appropriately
You can also use this VSCode extension on a specific file.
Running translations
To manually submit strings for translation, run npm run prebuild
. This will scrape all of the strings you wrapped in the previous step and send them to us for translation. This will also run when you run npm run build
. You can see the status of these translations on the Quetzal dashboard. For a few strings, it should only take a second. For many hundreds or thousands of strings, it may take a few minutes.
And now you’re done! Strings will be grabbed and translated when production builds are made going forward.