You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/AI.md
+46-62Lines changed: 46 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,88 +97,72 @@ Context is crucial for accurate and high-quality translations. With the enhanced
97
97
> [!IMPORTANT]
98
98
> Experiments have shown that LLM + AI Extracted Context can improve the translation quality by up to 75% and LLM + AI Extracted Context + Screenshots + Crowdin AI Tools can improve the translation quality by up to 95%.
99
99
100
-
### Harvesting Context with Crowdin Context Harvester CLI
100
+
### Extracting Context with AI Agents
101
101
102
102
To ensure that AI translations are accurate and contextually relevant, you need to provide the AI with the necessary context.
103
103
104
104
Crowdin allows you to provide various levels of context to the AI, including the options available during prompt configuration (glossary terms, TM suggestions, previous and next strings, file context, screenshots, and more). It's highly recommended that you provide the AI with as much context as possible to improve the quality of the translations.
105
105
106
-
You can use the [Crowdin Context Harvester CLI](https://store.crowdin.com/crowdin-context-harvester-cli) in your CI/CD pipeline to automate the context extraction process. The Context Harvester CLI is designed to simplify the process of extracting context for Crowdin strings from your code. Using Large Language Models (LLMs), it automatically analyzes your project code to find out how each key is used. This information is extremely useful for the human linguists or AI that will be translating your project keys, and is likely to improve the quality of the translation.
106
+
The recommended way to extract context from your codebase is to use the [Crowdin CLI context commands](https://crowdin.github.io/crowdin-cli/commands/crowdin-context) together with an AI coding agent (Claude Code, Cursor, GitHub Copilot, etc.). The agent analyzes your codebase to find out how each string is used and stores this information in Crowdin. It is extremely useful for the human linguists or AI that will be translating your project strings and is likely to improve the quality of the translation.
107
107
108
-
First, install the Crowdin Context Harvester CLI and configure it with your Crowdin project:
108
+
The workflow consists of three steps:
109
109
110
-
```bash
111
-
npm i -g crowdin-context-harvester
112
-
crowdin-context-harvester configure
113
-
```
110
+
1. **Download** the strings that are missing context to a local `crowdin-context.jsonl` file:
111
+
112
+
```bash
113
+
crowdin context download --status empty
114
+
```
114
115
115
-
You'll be asked to enter all the necessary information, such as your Crowdin Personal Access Token, Project ID, and other details.
116
+
2. **Enrich** — the AI agent fills in the `ai_context` field for each string based on your codebase.
116
117
117
-
For example:
118
+
3. **Upload** the enriched context back to Crowdin:
119
+
120
+
```bash
121
+
crowdin context upload
122
+
```
123
+
124
+
To teach your AI agent this workflow, install the [Crowdin Agent Skills](https://github.com/crowdin/skills). They include the `crowdin-context-cli` skill (context commands and JSONL format) and the `context-extraction` skill (rules for writing meaningful context):
118
125
119
126
```bash
120
-
crowdin-context-harvester configure
121
-
? What Crowdin product do you use? Crowdin.com
122
-
? Crowdin Personal API token (with Project, AI scopes): __your_personal_token_
123
-
? Crowdin project: Test Project
124
-
? AI provider: Crowdin AI Provider
125
-
? Crowdin AI provider (you should have the OpenAI provider configured in Crowdin): Open AI
126
-
? AI model (newest models with largest context window are preferred): gpt-4
127
-
? Model context window size in tokens: 128000
128
-
? Model maximum output tokens count: 16384
129
-
? Check if the code contains the key or the text of the string before sending it to the AI model
130
-
(recommended if you have thousands of keys to avoid chunking and improve speed).: I use keys in the code
131
-
? Custom prompt file. "-" to read from STDIN (optional):
132
-
? Local files (glob pattern): **/*.*
133
-
? Ignore local files (glob pattern). Make sure to exclude unnecessary files to avoid unnecessary AI API calls: /**/node_modules/**
134
-
? Crowdin files (glob pattern e.g. **/*.*).: **/*.*
135
-
? CroQL query (optional):
136
-
? Output: Terminal (dry run)
137
-
138
-
You can now execute the harvest command by running:
Once the skills are installed, a single prompt is enough for the agent to handle all the steps autonomously:
131
+
132
+
```
133
+
Use the Crowdin CLI to download strings that are missing context, enrich them
134
+
with precise UI placement descriptions based on our codebase, and upload the
135
+
enriched context back to Crowdin.
141
136
```
142
137
143
-
Once you have configured the Crowdin Context Harvester CLI, you can use the received `harvest`command to extract the context from your project files and provide it to the AI forbetter translationsin your CI/CD pipeline.
138
+
At any point, you can check the context coverage of your project by running `crowdin context status`.
144
139
145
-
Then, add the following steps to your GitHub Actions workflow to extract the context and provide it to the AI:
140
+
The context commands can also be executed as part of your GitHub Actions workflow using the `command` input:
>Make sure to omit the personal access token and project ID from the command line and store them in the GitHub Actions secrets. The CLI will automatically use the secrets if they are set.
164
+
> [!TIP]
165
+
> Read the [Automating i18n Context with AI Agents](https://crowdin.com/blog/automate-i18n-context-with-ai-agents) blog post to learn more about this workflow.
0 commit comments