xiaohongshu
xiaohongshu
lokalise-hello-world
Create a minimal working Lokalise example. Use when starting a new Lokalise integration, testing your setup, or learning basic Lokalise API patterns. Trigger with phrases like "lokalise hello world", "lokalise example", "lokalise quick start", "simple lokalise code".
Full skill instructions
Minimal working example demonstrating core Lokalise functionality: projects, keys, and translations.
lokalise-install-auth setup# Create project directory
mkdir lokalise-demo && cd lokalise-demo
npm init -y
npm install @lokalise/node-api dotenv
# Create main file
touch index.mjs
// index.mjs
import "dotenv/config";
import { LokaliseApi } from "@lokalise/node-api";
const lokaliseApi = new LokaliseApi({
apiKey: process.env.LOKALISE_API_TOKEN,
});
async function main() {
// List all projects
const projects = await lokaliseApi.projects().list();
console.log("Your Lokalise Projects:");
projects.items.forEach(p => {
console.log(` - ${p.name} (${p.project_id})`);
});
}
main().catch(console.error);
async function createProject() {
const project = await lokaliseApi.projects().create({
name: "My Demo Project",
description: "Created via API",
languages: [
{ lang_iso: "en", custom_iso: "" }, // English (base)
{ lang_iso: "es", custom_iso: "" }, // Spanish
{ lang_iso: "fr", custom_iso: "" }, // French
],
base_lang_iso: "en",
});
console.log(`Created project: ${project.name}`);
console.log(`Project ID: ${project.project_id}`);
return project;
}
async function addKeys(projectId: string) {
const keys = await lokaliseApi.keys().create({
project_id: projectId,
keys: [
{
key_name: "welcome.title",
platforms: ["web"],
translations: [
{ language_iso: "en", translation: "Welcome to our app!" },
{ language_iso: "es", translation: "Bienvenido a nuestra app!" },
{ language_iso: "fr", translation: "Bienvenue dans notre app!" },
],
},
{
key_name: "welcome.subtitle",
platforms: ["web"],
translations: [
{ language_iso: "en", translation: "Get started today" },
],
},
],
});
console.log(`Created ${keys.items.length} keys`);
return keys;
}
async function getTranslations(projectId: string) {
const translations = await lokaliseApi.translations().list({
project_id: projectId,
filter_lang_id: 640, // English language ID
});
console.log("English translations:");
translations.items.forEach(t => {
console.log(` ${t.key_id}: ${t.translation}`);
});
}
| Error | Cause | Solution |
|---|---|---|
401 Unauthorized | Invalid token | Check LOKALISE_API_TOKEN |
400 Bad Request | Invalid project/key params | Verify required fields |
404 Not Found | Project doesn't exist | Check project_id |
429 Too Many Requests | Rate limit hit | Wait 1 second, retry |
import "dotenv/config";
import { LokaliseApi } from "@lokalise/node-api";
const lokaliseApi = new LokaliseApi({
apiKey: process.env.LOKALISE_API_TOKEN,
});
async function helloLokalise() {
// 1. List existing projects
const projects = await lokaliseApi.projects().list();
console.log(`Found ${projects.items.length} existing projects\n`);
// 2. Create a demo project
const project = await lokaliseApi.projects().create({
name: `Demo ${Date.now()}`,
languages: [
{ lang_iso: "en" },
{ lang_iso: "es" },
],
base_lang_iso: "en",
});
console.log(`Created: ${project.name} (${project.project_id})\n`);
// 3. Add a key with translations
const keys = await lokaliseApi.keys().create({
project_id: project.project_id,
keys: [{
key_name: "greeting",
platforms: ["web"],
translations: [
{ language_iso: "en", translation: "Hello, World!" },
{ language_iso: "es", translation: "Hola, Mundo!" },
],
}],
});
console.log(`Added ${keys.items.length} key(s)\n`);
// 4. Fetch the key back
const fetchedKey = await lokaliseApi.keys().get(keys.items[0].key_id, {
project_id: project.project_id,
});
console.log(`Key: ${fetchedKey.key_name.web}`);
// 5. Clean up (optional)
// await lokaliseApi.projects().delete(project.project_id);
console.log("\nSuccess! Your Lokalise integration is working.");
}
helloLokalise().catch(console.error);
# List projects
lokalise2 --token $LOKALISE_API_TOKEN project list
# Get project details
lokalise2 --token $LOKALISE_API_TOKEN project --project-id YOUR_PROJECT_ID
# List keys in a project
lokalise2 --token $LOKALISE_API_TOKEN key list --project-id YOUR_PROJECT_ID
Proceed to lokalise-local-dev-loop for development workflow setup.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience