Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implement Lokalise translation data handling, PII management, and compliance patterns. Use when handling sensitive translation data, implementing data redaction, or ensuring compliance with privacy regulations for Lokalise integrations. Trigger with phrases like "lokalise data", "lokalise PII", "lokalise GDPR", "lokalise data retention", "lokalise privacy", "lokalise compliance".
.claude/skills/jeremylongshore-lokalise-data-handling/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 75% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 53% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 176% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 89% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 77% | 0% |
Lokalise manages translation data through keys, translations, snapshots, and branches. This skill covers the translation data lifecycle (create, update, export), key metadata management (tags, descriptions, screenshots), translation snapshots for versioning, branch-based translation isolation, export format handling (JSON flat/nested, XLIFF, PO), character encoding (UTF-8 BOM handling), and plural form support across locales.
@lokalise/node-api SDK installed (npm install @lokalise/node-api)lokalise2 CLI for bulk file operations (optional)Translation data in Lokalise follows this flow: Create keys (with platforms, tags, descriptions) -> Add base translations (source language) -> Translate (manually or via integrations) -> Review (proofread flag) -> Export (download to codebase).
Create keys with metadata that helps translators:
typescriptimport { LokaliseApi } from "@lokalise/node-api"; const lokalise = new LokaliseApi({ apiKey: process.env.LOKALISE_API_TOKEN! }); // Create keys with rich metadata await lokalise.keys().create({ project_id: projectId, keys: [ { key_name: { ios: "welcome.title", android: "welcome_title", web: "welcome.title", other: "welcome.title", }, description: "Main heading on the welcome screen shown after signup", platforms: ["web", "ios", "android"], tags: ["onboarding", "v2.1"], base_translations: [ { language_iso: "en", translation: "Welcome to {{appName}}" }, ], is_plural: false, is_hidden: false, }, ], });
Tags, descriptions, and screenshots help translators understand context. Keep metadata current:
typescript// Bulk update tags for release management await lokalise.keys().bulk_update({ project_id: projectId, keys: [ { key_id: 12345, tags: ["release-3.0", "reviewed"] }, { key_id: 12346, tags: ["release-3.0", "needs-review"] }, ], }); // Add a screenshot for visual context await lokalise.screenshots().create({ project_id: projectId, screenshots: [ { data: base64EncodedImage, // Base64 JPEG/PNG, max 6 MB title: "Welcome screen — mobile layout", description: "Shows welcome.title and welcome.subtitle keys", key_ids: [12345, 12346], }, ], }); // Retrieve key with all metadata const key = await lokalise.keys().get(keyId, { project_id: projectId, disable_references: 0, // include reference language info }); console.log(key.key_name, key.tags, key.description);
Snapshots capture the entire project state at a point in time. Create them before bulk changes:
typescript// Create a snapshot before a major update const snapshot = await lokalise.snapshots().create({ project_id: projectId, title: `Pre-release v3.0 — ${new Date().toISOString()}`, }); console.log(`Snapshot created: ${snapshot.snapshot_id}`); // List snapshots const snapshots = await lokalise.snapshots().list({ project_id: projectId, limit: 20, }); snapshots.items.forEach((s) => console.log(`${s.snapshot_id}: ${s.title} (${s.created_at})`) ); // Restore a snapshot (creates a NEW project with the snapshot data) const restored = await lokalise.snapshots().restore(snapshotId, { project_id: projectId, }); console.log(`Restored to new project: ${restored.project_id}`);
Snapshots are immutable. Restoring creates a new project — it does not overwrite the current one.
Branches let you work on translations for a feature without affecting production strings:
typescript// Create a feature branch await lokalise.branches().create({ project_id: projectId, name: "feature/checkout-redesign", }); // List branches const branches = await lokalise.branches().list({ project_id: projectId }); // Work on the branch — use the branch name in file operations await lokalise.files().upload({ project_id: projectId, data: base64FileContent, filename: "en.json", lang_iso: "en", use_automations: true, branch: "feature/checkout-redesign", // target the branch }); // Merge branch back to main when translations are ready await lokalise.branches().merge(branchId, { project_id: projectId, force_current: false, // false = conflict detection enabled });
Lokalise supports multiple export formats. Choose based on your stack:
typescript// Download as flat JSON (React, Next.js, Vue) const flatJson = await lokalise.files().download({ project_id: projectId, format: "json", original_filenames: false, bundle_structure: "locales/%LANG_ISO%.json", json_unescaped_slashes: true, export_empty_as: "base", // use base language for untranslated include_tags: ["release-3.0"], filter_langs: ["en", "fr", "de", "ja"], }); // Returns { bundle_url: "https://..." } — download the ZIP
typescript// Download as nested JSON (common for namespaced i18n) const nestedJson = await lokalise.files().download({ project_id: projectId, format: "json", original_filenames: false, bundle_structure: "locales/%LANG_ISO%/%FILENAME%.json", json_unescaped_slashes: true, export_key_as: "key_name_dots_to_nested", // a.b.c → {a:{b:{c:"..."}}} });
bash# Export as XLIFF 2.0 (for professional translation agencies) lokalise2 file download \ --token "$LOKALISE_API_TOKEN" \ --project-id "$PROJECT_ID" \ --format xliff \ --dest ./translations/ \ --include-tags "release-3.0" # Export as PO/POT (for gettext-based projects) lokalise2 file download \ --token "$LOKALISE_API_TOKEN" \ --project-id "$PROJECT_ID" \ --format po \ --dest ./locales/ \ --export-empty-as base
All Lokalise exports use UTF-8. Watch for these encoding issues:
typescript// Remove UTF-8 BOM if present (some editors add it) function stripBOM(content: string): string { return content.charCodeAt(0) === 0xfeff ? content.slice(1) : content; } // Validate JSON translation files after download import { readFileSync } from "fs"; function loadTranslations(filePath: string): Record<string, string> { const raw = readFileSync(filePath, "utf-8"); const clean = stripBOM(raw); try { return JSON.parse(clean); } catch (e) { throw new Error( `Invalid JSON in ${filePath}: ${(e as Error).message}. ` + `Check for encoding issues or unescaped characters.` ); } }
When uploading files, always specify UTF-8 encoding. Lokalise auto-detects encoding but explicit is safer:
bash# Upload with explicit encoding lokalise2 file upload \ --token "$LOKALISE_API_TOKEN" \ --project-id "$PROJECT_ID" \ --file ./locales/en.json \ --lang-iso en \ --convert-placeholders true
Lokalise uses CLDR plural rules. Different languages have different plural categories:
typescript// Create a plural key await lokalise.keys().create({ project_id: projectId, keys: [ { key_name: "items.count", is_plural: true, platforms: ["web"], base_translations: [ { language_iso: "en", translation: JSON.stringify({ one: "{{count}} item", other: "{{count}} items", }), }, ], }, ], });
Plural categories by language:
| Language | Categories | Example | |----------|-----------|---------| | English | one, other | 1 item / 2 items | | French | one, many, other | 1 chose / 1000000 choses / 2 choses | | Arabic | zero, one, two, few, many, other | 6 categories | | Japanese | other | No plural distinction | | Polish | one, few, many, other | 1 element / 2 elementy / 5 elementow |
In JSON exports, plural keys appear as objects:
json{ "items.count": { "one": "{{count}} item", "other": "{{count}} items" } }
Ensure your i18n framework handles plural objects (i18next, react-intl, vue-i18n all support this natively).
| Issue | Cause | Solution | |-------|-------|----------| | Garbled characters in export | BOM or wrong encoding assumed | Strip BOM, ensure UTF-8 | | Missing plural form | Language requires categories not provided | Check CLDR plural rules for target language | | Branch merge conflict | Same key modified in both branches | Resolve via Lokalise UI or set force_current: true | | Snapshot restore fails | Exceeded project limit on plan | Delete unused projects or upgrade plan | | Empty translations in export | Key has no translation for language | Use export_empty_as: "base" to fall back to source | | Upload overwrites existing | Default merge behavior is replace | Use replace_modified: false to preserve existing |
typescriptimport { readFileSync } from "fs"; const fileContent = readFileSync("./locales/en.json", "utf-8"); const base64Content = Buffer.from(fileContent).toString("base64"); await lokalise.files().upload({ project_id: projectId, data: base64Content, filename: "en.json", lang_iso: "en", convert_placeholders: true, detect_icu_plurals: true, replace_modified: false, // preserve manual edits tags_inserted_keys: ["auto-import"], });
bash#!/bin/bash # download-translations.sh BUNDLE_URL=$(curl -s -X POST \ "https://api.lokalise.com/api2/projects/${PROJECT_ID}/files/download" \ -H "X-Api-Token: ${LOKALISE_API_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "format": "json", "original_filenames": false, "bundle_structure": "locales/%LANG_ISO%.json", "export_empty_as": "base", "json_unescaped_slashes": true }' | jq -r '.bundle_url') curl -sL "$BUNDLE_URL" -o translations.zip unzip -o translations.zip -d ./src/ rm translations.zip echo "Translations downloaded and extracted to ./src/locales/"
For deploying translations into your CI/CD pipeline, see lokalise-deploy-integration. For handling API errors during data operations, see lokalise-common-errors.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-21 | pass→pass | 16,615 | 13,627 | -18% | 1 | 1 | 0% | 2,632 | 5,412 | +106% | 0 | 0 | — |
case-01 | fail→fail | 20,189 | 18,197 | -10% | 1 | 1 | 0% | 3,016 | 5,950 | +97% | 0 | 0 | — |
case-02 | fail→pass | 21,392 | 21,238 | -1% | 1 | 1 | 0% | 3,237 | 5,676 | +75% | 0 | 0 | — |
case-03 | fail→fail | 19,076 | 16,248 | -15% | 1 | 1 | 0% | 2,332 | 5,637 | +142% | 0 | 0 | — |
case-04 | pass→pass | 14,396 | 13,444 | -7% | 1 | 1 | 0% | 1,575 | 4,801 | +205% | 0 | 0 | — |
case-05 | fail→pass | 22,352 | 8,840 | -60% | 1 | 1 | 0% | 2,580 | 3,954 | +53% | 0 | 0 | — |
case-06 | pass→pass | 15,739 | 13,062 | -17% | 1 | 1 | 0% | 1,963 | 4,303 | +119% | 0 | 0 | — |
case-07 | fail→pass | 15,303 | 8,998 | -41% | 1 | 1 | 0% | 1,391 | 3,840 | +176% | 0 | 0 | — |
case-08 | pass→pass | 13,065 | 9,979 | -24% | 1 | 1 | 0% | 1,424 | 4,196 | +195% | 0 | 0 | — |
case-09 | pass→pass | 11,293 | 11,379 | +1% | 1 | 1 | 0% | 2,065 | 4,343 | +110% | 0 | 0 | — |
case-10 | fail→pass | 18,152 | 15,059 | -17% | 1 | 1 | 0% | 2,671 | 5,041 | +89% | 0 | 0 | — |
case-11 | pass→pass | 15,102 | 3,800 | -75% | 1 | 1 | 0% | 1,744 | 3,856 | +121% | 0 | 0 | — |
case-12 | fail→fail | 14,769 | 8,243 | -44% | 1 | 1 | 0% | 2,025 | 4,731 | +134% | 0 | 0 | — |
case-13 | fail→pass | 15,225 | 5,356 | -65% | 1 | 1 | 0% | 2,363 | 4,178 | +77% | 0 | 0 | — |
case-14 | fail→pass | 18,132 | 17,367 | -4% | 1 | 1 | 0% | 2,626 | 5,080 | +93% | 0 | 0 | — |
case-15 | fail→pass | 6,189 | 9,899 | +60% | 1 | 1 | 0% | 918 | 3,935 | +329% | 0 | 0 | — |
case-20 | pass→pass | 13,982 | 7,388 | -47% | 1 | 1 | 0% | 1,373 | 4,578 | +233% | 0 | 0 | — |
case-16 | pass→pass | 8,630 | 4,460 | -48% | 1 | 1 | 0% | 1,644 | 4,003 | +143% | 0 | 0 | — |
case-17 | pass→pass | 10,584 | 5,996 | -43% | 1 | 1 | 0% | 1,660 | 4,003 | +141% | 0 | 0 | — |
case-18 | pass→pass | 15,773 | 4,972 | -68% | 1 | 1 | 0% | 1,928 | 4,055 | +110% | 0 | 0 | — |
case-19 | fail→pass | 5,944 | 10,142 | +71% | 1 | 1 | 0% | 1,149 | 3,926 | +242% | 0 | 0 | — |
case-22 | pass→pass | 18,527 | 12,252 | -34% | 1 | 1 | 0% | 2,520 | 5,659 | +125% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +36 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.