Thank you for contributing to Lingo.dev! We're an exciting open source project and we'd love to have you contribute!
Here's some resources and guidance to help you get started:
Here's how to get the project running locally:
- Node.js: Make sure you have Node.js version 18 or higher installed.
- pnpm: You can install using this command
npm install -g pnpmor by following this guide - AI API Key:
Currently, Groq, Google, and Mistral are supported.
- GROQ API Key: You can get one by signing up at Groq
- GOOGLE API Key: You can get one in the Google AI Studio
- MISTRAL API Key: You can get one by signing up at Mistral AI
To set up the project, clone the repository and install the dependencies:
git clone https://github.com/lingodotdev/lingo.dev
cd lingo.dev
pnpm installNext, configure an AI API key. You can configure a key in two different ways:
Option A: User-wide (Recommended for development):
Run one of the following commands that corresponds with the AI provider you want to use in a terminal window. Replace <your-api-key> with your actual API key. You can configure Groq, Google, or Mistral.
Groq:
npx lingo.dev@latest config set llm.groqApiKey <your-api-key>Google:
npx lingo.dev@latest config set llm.googleApiKey <your-api-key>Mistral:
npx lingo.dev@latest config set llm.mistralApiKey <your-api-key>This will store the key in your system's user configuration, allowing you to build the project without needing to set it up in each demo directory.
Option B: Project-wide (Alternative):
Run the following command in a terminal window. Replace <your-api-key> with your actual API key:
Groq:
# Create .env files in demo directories
echo "GROQ_API_KEY=<your-api-key>" > demo/react-router-app/.env
echo "GROQ_API_KEY=<your-api-key>" > demo/next-app/.env
echo "GROQ_API_KEY=<your-api-key>" > demo/vite-project/.envGoogle:
echo "GOOGLE_API_KEY=<your-api-key>" > demo/react-router-app/.env
echo "GOOGLE_API_KEY=<your-api-key>" > demo/next-app/.env
echo "GOOGLE_API_KEY=<your-api-key>" > demo/vite-project/.envMistral:
echo "MISTRAL_API_KEY=<your-api-key>" > demo/react-router-app/.env
echo "MISTRAL_API_KEY=<your-api-key>" > demo/next-app/.env
echo "MISTRAL_API_KEY=<your-api-key>" > demo/vite-project/.envThis will create .env files in each demo directory with your AI API key set as an environment variable.
Note: When loading LLM API keys (including Groq, Google, and Mistral), the Lingo.dev Compiler checks the following sources in order of priority:
- Environment variables (via
process.env) - Environment files (
.env,.env.local,.env.development) - Lingo.dev configuration
Next, you can run the project using the following commands:
# start the build process
pnpm turbo build
# in terminal window 1 - watch for CLI code changes
cd packages/cli
pnpm run dev
# in terminal window 2 - test the CLI
cd packages/cli
pnpm lingo.dev --help # this command will use the current cli code + demo config from ./package/i18n.jsonFeel free to ask questions on our Discord server!
Want to add support for a new LLM provider to Lingo.dev? Here's a checklist to help you get started:
-
Add Your Dependency
-
Update the Config Schema
- Edit
packages/spec/src/config.tsand update the list of allowed provideridvalues to include your new provider.
- Edit
-
Provider Details
- Add your provider to
packages/compiler/src/lib/lcp/api/provider-details.tswith name, env var, config key, API docs, and signup link.
- Add your provider to
-
API Key Handling
- Update
packages/compiler/src/utils/llm-api-key.tsto add functions for getting the API key from environment/config.
- Update
-
CLI and Compiler Logic
- Update the CLI (e.g.,
packages/cli/src/cli/localizer/explicit.ts,packages/cli/src/cli/processor/index.ts) to support your provider. - Update the compiler's translation logic to instantiate your provider's client (see
packages/compiler/src/lib/lcp/api/index.ts).
- Update the CLI (e.g.,
-
Error Handling
- Ensure user-facing error messages are updated to mention your provider where relevant (API key checks, troubleshooting, etc).
-
Test and Document
- Add or update tests to cover your provider.
- Update documentation and this contributing guide as needed.
Tip: Look at how existing providers like "groq", "google", and "mistral" are implemented for reference. Consistency helps us maintain quality and predictability!
If you find a bug, please create an Issue and we'll triage it.
- Please search existing Issues before creating a new one
- Please include a clear description of the problem along with steps to reproduce it. Exact steps with screenshots and urls really help here
- Before starting work on an issue, please comment on it and wait for it to be assigned to you. This prevents multiple people from working on the same issue simultaneously
- Let's discuss implementation details in the issue comments or Discord before starting work, to ensure alignment between contributors and the Lingo.dev team
We actively welcome your Pull Requests! A couple of things to keep in mind before you submit:
- If you're fixing an Issue, make sure someone else hasn't already created a PR fixing the same issue
- Make sure to link your PR to the related Issue(s)
- We will always try to accept the first viable PR that resolves the Issue
- Please discuss implementation approach beforehand to avoid having PRs rejected
Be sure to run pnpm new after you're done with the changes. This will use changesets library to trigger a new version after the PR is merged to the main branch. Be sure to do that after requesting a review from the maintainers: the CI build will fail if you don't run pnpm new.