lokalise-data-handling
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".
What this skill does
# Lokalise Data Handling
## Overview
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.
## Prerequisites
- `@lokalise/node-api` SDK installed (`npm install @lokalise/node-api`)
- API token with read/write access to the target project
- Understanding of i18n key naming conventions for your project
- `lokalise2` CLI for bulk file operations (optional)
## Instructions
### 1. Understand the Translation Data Lifecycle
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:
```typescript
import { 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,
},
],
});
```
### 2. Manage Key Metadata
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);
```
### 3. Use Snapshots for Translation Versioning
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.
### 4. Use Branches for Translation Isolation
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
});
```
### 5. Handle Export Formats
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
```
### 6. Handle Character Encoding
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
```
### 7. Handle Plural Forms
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 JSRelated 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.