55When adding new translation keys, use the Tolgee REST API at ` https://app.tolgee.io ` . The API key is stored in
66` .env.development.local ` as ` VITE_APP_TOLGEE_API_KEY ` .
77
8- ** Important:** Do NOT edit local translation files (` public/i18n/en.json ` , etc.). Tolgee serves translations at runtime
8+ ** Important:** Do NOT edit local translation files (` src/i18n/en.json ` , etc. — the ` pull.path ` in
9+ ` .tolgeerc.json ` ). Tolgee serves translations at runtime
910via its API/CDN, so local files are only fallbacks shipped with the repo. New keys only need to be created via the
1011Tolgee REST API — the running app will pick them up automatically.
1112
@@ -75,11 +76,10 @@ curl -X POST "https://app.tolgee.io/v2/image-upload" \
7576
7677Response includes ` "id": 123456 ` — this is the ` uploadedImageId ` for the next step.
7778
78- ### 3. Create Keys with Translations, Tags, and Screenshots
79+ ### 3. Create Keys with Translations and Screenshots
7980
80- Use ` single-step-import-resolvable ` to create all keys at once with their translations, tags, and screenshot
81- references in a single API call. This replaces the need for separate key creation, tagging, and screenshot
82- association steps.
81+ Use ` single-step-import-resolvable ` to create all keys at once with their translations and screenshot
82+ references in a single API call.
8383
8484** Endpoint:** ` POST https://app.tolgee.io/v2/projects/single-step-import-resolvable `
8585
@@ -92,9 +92,11 @@ curl -X POST "https://app.tolgee.io/v2/projects/single-step-import-resolvable" \
9292 {
9393 "name": "my_key",
9494 "translations": {
95- "en": "English text"
95+ "en": {
96+ "text": "English text",
97+ "resolution": "EXPECT_NO_CONFLICT"
98+ }
9699 },
97- "tags": ["draft: my-feature-branch"],
98100 "screenshots": [{
99101 "uploadedImageId": 123456,
100102 "positions": [{"x": 100, "y": 200, "width": 150, "height": 40}]
@@ -107,9 +109,48 @@ curl -X POST "https://app.tolgee.io/v2/projects/single-step-import-resolvable" \
107109Map each entry from ` getVisibleKeys() ` to a key in the ` keys ` array, using the ` position ` values for ` positions ` .
108110A key appearing multiple times (e.g. repeated buttons) should have multiple entries in ` positions ` .
109111Only provide translations for the base language (English [ en] ).
110- Tag each key using the branch tagging convention (see below): ` "tags": ["draft: <feature-name>"] ` .
111112
112- ### 4. Upload Context (Related Keys)
113+ The request accepts ` name ` , ` namespace ` , ` translations ` and ` screenshots ` — ** there is no ` tags ` field** .
114+ A ` tags ` array here is silently ignored and the call still returns 200, so tag in a separate step (see below).
115+
116+ ` resolution ` is ` OVERRIDE ` by default, which overwrites an existing translation. Use
117+ ` EXPECT_NO_CONFLICT ` when the keys are meant to be new — the import then fails instead of
118+ overwriting someone's existing translation, and the response reports ` unresolvedConflicts ` .
119+
120+ ### 4. Tag Keys as Draft
121+
122+ Tag keys with the current branch name (without username prefix). Format: ` draft: <feature-name> `
123+
124+ ** Endpoint:** ` PUT https://app.tolgee.io/v2/projects/tag-complex `
125+
126+ ``` bash
127+ curl -X PUT " https://app.tolgee.io/v2/projects/tag-complex" \
128+ -H " X-API-Key: ${VITE_APP_TOLGEE_API_KEY} " \
129+ -H " Content-Type: application/json" \
130+ -d ' {
131+ "filterKeys": [
132+ { "name": "my_translation_key_1" },
133+ { "name": "my_translation_key_2", "namespace": "my-namespace" }
134+ ],
135+ "tagFiltered": ["draft: my-feature-branch"]
136+ }'
137+ ```
138+
139+ Each ` filterKeys ` entry matches on name ** and** namespace, so pass the ` namespace ` of every
140+ namespaced key (the ` keyNamespace ` from ` getVisibleKeys() ` ). Omitting it means the default
141+ namespace, and a namespaced key silently stays untagged while the call still returns 200.
142+
143+ Verify the tags landed rather than trusting the status code — query the keys back with
144+ ` filterTag ` and check the count matches:
145+
146+ ``` bash
147+ curl -s -G " https://app.tolgee.io/v2/projects/translations" \
148+ -H " X-API-Key: ${VITE_APP_TOLGEE_API_KEY} " \
149+ --data-urlencode " languages=en" \
150+ --data-urlencode " filterTag=draft: my-feature-branch"
151+ ```
152+
153+ ### 5. Upload Context (Related Keys)
113154
114155Store which keys appear together on the same page/component for better MT suggestions. Requires at least 2 keys.
115156
0 commit comments