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".
Dicklesworthstone749 スター2026/02/05
職業
カテゴリ
データベースツール
スキル内容
Overview
Comprehensive guide for migrating to Lokalise from other TMS platforms or legacy systems.
# Export from common platforms
# Phrase
phrase pull --format json --target ./export/phrase/
# Crowdin (using CLI)
crowdin download --all --export-only-approved
# POEditor
# Use web export or API to download all languages
# Generic: Export all files in JSON/XLIFF format
# Ensure consistent naming: en.json, es.json, fr.json, etc.
Step 3: Data Transformation
// Transform exported data to Lokalise-compatible format
interface SourceKey {
key: string;
value: string;
description?: string;
tags?: string[];
context?: string;
}
interface LokaliseImportKey {
key_name: string;
platforms: string[];
description?: string;
tags?: string[];
translations: Array<{
language_iso: string;
translation: string;
}>;
}
function transformKeys(
sourceKeys: SourceKey[],
translations: Record<string, Record<string, string>>,
languages: string[]
): LokaliseImportKey[] {
return sourceKeys.map(src => ({
key_name: src.key,
platforms: ["web"], // Adjust based on your needs
description: src.description || src.context,
tags: src.tags || ["migrated"],
translations: languages.map(lang => ({
language_iso: lang,
translation: translations[lang]?.[src.key] || "",
})).filter(t => t.translation),
}));
}
// Handle platform-specific quirks
function normalizeKey(key: string, sourceSystem: string): string {
switch (sourceSystem) {
case "phrase":
// Phrase uses dot notation by default
return key;
case "crowdin":
// Crowdin may use file paths in key names
return key.replace(/^.*\//, "");
case "poeditor":
// POEditor exports may have different formats
return key.replace(/\s+/g, "_").toLowerCase();
default:
return key;
}
}
Step 4: Create Lokalise Project
import { LokaliseApi } from "@lokalise/node-api";
const client = new LokaliseApi({
apiKey: process.env.LOKALISE_API_TOKEN!,
});
async function createMigrationProject(
name: string,
languages: string[],
baseLanguage: string
): Promise<string> {
const project = await client.projects().create({
name: `${name} (Migration)`,
description: `Migrated from legacy system on ${new Date().toISOString()}`,
languages: languages.map(lang => ({
lang_iso: lang,
})),
base_lang_iso: baseLanguage,
});
console.log(`Created project: ${project.project_id}`);
return project.project_id;
}
// Convert placeholders between formats
function convertPlaceholders(
text: string,
fromFormat: "printf" | "icu" | "curly",
toFormat: "icu"
): string {
if (fromFormat === "printf") {
// %s, %d, %1$s -> {0}, {1}, etc.
let index = 0;
return text.replace(/%(\d+\$)?[sd]/g, () => `{${index++}}`);
}
if (fromFormat === "curly") {
// {{name}} -> {name}
return text.replace(/\{\{(\w+)\}\}/g, "{$1}");
}
return text;
}
Migration Rollback
#!/bin/bash
# rollback-migration.sh
# If migration fails, delete the new project
lokalise2 --token "$LOKALISE_API_TOKEN" \
project delete --project-id "$NEW_PROJECT_ID"
# Keep using old system
echo "Migration rolled back. Continue using source system."