Quick Start
This guide gets Interceptor running in a typical JavaScript or TypeScript project.
1. Install
bash
pnpm add -D @wrkspace-co/interceptor2. Add environment variables
Create a .env in your project root:
bash
OPENAI_API_KEY=sk-your-real-keyIf you use another provider, set the corresponding env var. See LLM Providers.
3. Create a config
ts
import type { InterceptorConfig } from "@wrkspace-co/interceptor";
const config: InterceptorConfig = {
locales: ["en", "fr"],
defaultLocale: "en",
llm: {
provider: "openai",
model: "gpt-4o-mini",
apiKeyEnv: "OPENAI_API_KEY"
},
i18n: {
messagesPath: "src/locales/{locale}.json"
}
};
export default config;Save as interceptor.config.ts in your project root. Only locales, defaultLocale, llm.provider, and llm.model are required. Everything else is optional with defaults.
4. Run
bash
pnpm interceptorInterceptor will scan your code and update locale files at the configured path.
5. Integrate with your build
- For Vite projects, see Vite Integration.
- For Webpack and Next.js, see Webpack Integration and Next.js Integration.
Troubleshooting
- If no strings are found, confirm your
includepatterns and extractor settings. - If translations are missing, verify the locale file paths and
.envkeys.