lokalise-migration-deep-dive
Execute major migration to Lokalise from other TMS platforms with data migration strategies. Use when migrating to Lokalise from competitors, performing data imports, or re-platforming existing translation management to Lokalise. Trigger with phrases like "migrate to lokalise", "lokalise migration", "switch to lokalise", "lokalise import", "lokalise replatform".
What this skill does
# Lokalise Migration Deep Dive
## Current State
!`lokalise2 --version 2>/dev/null || echo 'CLI not installed'`
!`npm list @lokalise/node-api 2>/dev/null | grep lokalise || echo 'SDK not installed'`
!`node --version 2>/dev/null || echo 'Node.js not available'`
## Overview
Migrate translations from another TMS (Crowdin, Phrase, POEditor) into Lokalise — export from the source platform, transform key names and variable syntax to match Lokalise conventions, bulk upload via API, validate translation coverage, and handle key conflicts with format-aware tooling.
## Prerequisites
- Admin or export access to the source TMS platform
- Lokalise account with a plan that supports the target key count (Free: 500 keys, Pro: unlimited)
- `LOKALISE_API_TOKEN` environment variable set (read-write token)
- `lokalise2` CLI or `@lokalise/node-api` SDK installed
- `jq` for JSON manipulation during transformation
## Instructions
### Step 1: Export from Source Platform
Each TMS has its own export format. Export to a Lokalise-compatible format when possible (JSON, XLIFF, or the platform's native format).
**From Crowdin:**
```bash
set -euo pipefail
# Export all translations as JSON (flat key-value structure)
# Use Crowdin CLI or API to download
curl -X POST "https://api.crowdin.com/api/v2/projects/${CROWDIN_PROJECT_ID}/translations/builds" \
-H "Authorization: Bearer ${CROWDIN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"targetLanguageIds": [], "exportApprovedOnly": false}'
# Download the build when ready (poll build status first)
curl -X GET "https://api.crowdin.com/api/v2/projects/${CROWDIN_PROJECT_ID}/translations/builds/${BUILD_ID}/download" \
-H "Authorization: Bearer ${CROWDIN_TOKEN}" -o crowdin-export.zip
unzip crowdin-export.zip -d crowdin-export/
echo "Exported $(find crowdin-export/ -name '*.json' | wc -l) translation files"
```
**From Phrase (formerly PhraseApp):**
```bash
set -euo pipefail
# Export all locales as JSON
for LOCALE in en fr de es ja; do
curl -X GET "https://api.phrase.com/v2/projects/${PHRASE_PROJECT_ID}/locales/${LOCALE}/download?file_format=simple_json" \
-H "Authorization: token ${PHRASE_TOKEN}" \
-o "phrase-export/${LOCALE}.json"
sleep 0.5
done
echo "Exported locales: $(ls phrase-export/)"
```
**From POEditor:**
```bash
set -euo pipefail
# Export via POEditor API (returns a download URL)
EXPORT_URL=$(curl -s -X POST "https://api.poeditor.com/v2/projects/export" \
-d "api_token=${POEDITOR_TOKEN}&id=${POEDITOR_PROJECT_ID}&language=en&type=json" \
| jq -r '.result.url')
curl -s "$EXPORT_URL" -o poeditor-export/en.json
echo "Downloaded $(wc -c < poeditor-export/en.json) bytes"
```
### Step 2: Transform Keys and Variable Syntax
Different TMS platforms use different interpolation syntax. Lokalise supports multiple formats, but consistency matters.
```javascript
// transform-keys.mjs — Convert source format to Lokalise-compatible JSON
import { readFileSync, writeFileSync, readdirSync } from 'fs';
const VARIABLE_TRANSFORMS = {
// Crowdin ICU: {count} -> %{count} (for Ruby) or keep as {count} (for JS)
crowdin: (value) => value, // Crowdin uses ICU by default, Lokalise supports it
// Phrase: %{variable} -> {{variable}} (if targeting i18next)
phrase: (value) => value.replace(/%\{(\w+)\}/g, '{{$1}}'),
// POEditor: {{variable}} -> {variable} (if targeting ICU)
poeditor: (value) => value.replace(/\{\{(\w+)\}\}/g, '{$1}'),
};
const SOURCE = process.argv[2] || 'crowdin'; // crowdin | phrase | poeditor
const INPUT_DIR = process.argv[3] || 'source-export';
const OUTPUT_DIR = process.argv[4] || 'lokalise-import';
const transform = VARIABLE_TRANSFORMS[SOURCE] || ((v) => v);
for (const file of readdirSync(INPUT_DIR).filter(f => f.endsWith('.json'))) {
const data = JSON.parse(readFileSync(`${INPUT_DIR}/${file}`, 'utf8'));
const transformed = {};
// Flatten nested keys with dot notation (Lokalise convention)
function flatten(obj, prefix = '') {
for (const [key, value] of Object.entries(obj)) {
const fullKey = prefix ? `${prefix}.${key}` : key;
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
flatten(value, fullKey);
} else {
transformed[fullKey] = transform(String(value));
}
}
}
flatten(data);
writeFileSync(`${OUTPUT_DIR}/${file}`, JSON.stringify(transformed, null, 2));
console.log(`Transformed ${file}: ${Object.keys(transformed).length} keys`);
}
```
```bash
set -euo pipefail
mkdir -p lokalise-import
node transform-keys.mjs crowdin crowdin-export lokalise-import
```
### Step 3: Create Lokalise Project and Upload
```bash
set -euo pipefail
# Create a new project for the migration
PROJECT=$(curl -s -X POST "https://api.lokalise.com/api2/projects" \
-H "X-Api-Token: ${LOKALISE_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"name": "Migration from Crowdin",
"description": "Migrated translations",
"base_lang_iso": "en",
"languages": [
{"lang_iso": "en"}, {"lang_iso": "fr"}, {"lang_iso": "de"},
{"lang_iso": "es"}, {"lang_iso": "ja"}
]
}')
PROJECT_ID=$(echo "$PROJECT" | jq -r '.project_id')
echo "Created project: ${PROJECT_ID}"
```
### Step 4: Bulk Upload Translation Files
```bash
set -euo pipefail
# Upload each language file — Lokalise processes uploads asynchronously
for FILE in lokalise-import/*.json; do
LANG=$(basename "$FILE" .json) # Filename must match lang_iso (e.g., en.json, fr.json)
# Upload via CLI (handles base64 encoding automatically)
lokalise2 --token "${LOKALISE_API_TOKEN}" \
file upload \
--project-id "${PROJECT_ID}" \
--file "$FILE" \
--lang-iso "${LANG}" \
--replace-modified \
--distinguish-by-file \
--poll \
--poll-timeout 120s
echo "Uploaded ${LANG}: $(jq 'length' "$FILE") keys"
sleep 0.5 # Rate limit buffer
done
```
**Alternative: Upload via API (when CLI is unavailable):**
```bash
set -euo pipefail
FILE_CONTENT=$(base64 -w 0 lokalise-import/en.json)
curl -X POST "https://api.lokalise.com/api2/projects/${PROJECT_ID}/files/upload" \
-H "X-Api-Token: ${LOKALISE_API_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"data\": \"${FILE_CONTENT}\",
\"filename\": \"en.json\",
\"lang_iso\": \"en\",
\"replace_modified\": true,
\"distinguish_by_file\": false
}"
# Upload is async — poll the returned process ID
```
### Step 5: Validate Coverage
```typescript
import { LokaliseApi } from '@lokalise/node-api';
const lok = new LokaliseApi({ apiKey: process.env.LOKALISE_API_TOKEN! });
async function validateMigration(projectId: string, expectedKeys: number) {
// Get project statistics
const project = await lok.projects().get(projectId);
const stats = project.statistics;
console.log('=== Migration Validation ===');
console.log(`Keys imported: ${stats.keys_total} (expected: ${expectedKeys})`);
console.log(`Languages: ${stats.languages?.length}`);
console.log(`Overall progress: ${stats.progress_total}%`);
// Check per-language coverage
const languages = await lok.languages().list({ project_id: projectId, limit: 100 });
for (const lang of languages.items) {
const pct = lang.words_reviewed !== undefined
? Math.round((lang.words_reviewed / (lang.words || 1)) * 100)
: 'N/A';
console.log(` ${lang.lang_iso}: ${lang.words} words, ${pct}% reviewed`);
}
// Flag gaps
if (stats.keys_total < expectedKeys) {
console.warn(`WARNING: ${expectedKeys - stats.keys_total} keys missing after import`);
}
}
await validateMigration(process.env.PROJECT_ID!, 5000);
```
### Step 6: Handle Key Conflicts
When importing into an existing project, keys may already exist. Lokalise offers conflict resolution via upload parameters:
```bash
set -euo pipefail
# Upload with explicit conflict handling
lokalise2 --token "${LOKALISE_API_TOKEN}" \
file upload \
--project-id "${PROJECT_ID}" \
--file lokalise-import/en.json \
--lang-iso en \
--replRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.