Docs

Getting started

You need Node 22+ and a React, Next.js or vanilla JS/TS project.

1. Create the config

npx glotfox init --source en --targets de,fr

This writes glotfox.config.json with the source locale, target locales and the folders to scan. Commit it. See the file format spec for all options.

2. Use translation keys in code

t('greeting', 'Hello, {name}!');
t('cart.title', { defaultValue: 'Your cart', description: 'Heading of the cart page' });
<Trans i18nKey="checkout.pay" defaults="Pay now" />

3. Extract keys

npx glotfox extract

New keys are written to locales/en/<namespace>.json. Existing keys and translations are never deleted; keys no longer used in code are reported.

4. Generate types (optional)

Set "output": { "types": "src/glotfox.d.ts" } in the config and run npx glotfox types. Unknown keys and missing placeholders then fail type-checking.

5. Sync with GlotFox

Create a project and an API key in the dashboard, then:

export GLOTFOX_API_KEY=gf_...
npx glotfox push   # upload source keys
npx glotfox pull   # write approved translations into locales/

6. Automate it

Connect the repository through the GitHub integration and add the CI workflow, so keys are imported on every push and pull requests are checked.