技能 编程开发 Lokalise SDK 实战规范

Lokalise SDK 实战规范

v20260311
lokalise-sdk-patterns
为 TypeScript/Node 项目提供 Lokalise SDK 实战模式,涵盖单例客户端、自动重试、限流队列、游标分页以及稳健的错误处理,助力集成与团队规范化。
获取技能
224 次下载
概览

Lokalise SDK Patterns

Overview

Production-ready patterns for Lokalise SDK usage in TypeScript and Node.js applications.

Prerequisites

  • Completed lokalise-install-auth setup
  • Familiarity with async/await and TypeScript
  • Understanding of error handling best practices

Instructions

  1. For full implementation details, load: Read(${CLAUDE_SKILL_DIR}/references/implementation-guide.md)

Output

  • Type-safe client singleton with compression
  • Robust error handling with retryable detection
  • Rate-limited request queue
  • Automatic retry with exponential backoff
  • Cursor pagination for large datasets

Error Handling

Pattern Use Case Benefit
Safe wrapper All API calls Prevents uncaught exceptions
Request queue Bulk operations Respects rate limits
Retry logic Transient failures Improves reliability
Pagination Large datasets Memory efficient

Examples

Branch-Aware Client

export function getProjectWithBranch(projectId: string, branch?: string): string {
  // Lokalise branch syntax: projectId:branchName
  return branch ? `${projectId}:${branch}` : projectId;
}

// Usage
const projectId = getProjectWithBranch("123456.abcdef", "feature/new-ui");
const keys = await client.keys().list({ project_id: projectId });

Resources

Next Steps

Apply patterns in lokalise-core-workflow-a for real-world usage.

信息
Category 编程开发
Name lokalise-sdk-patterns
版本 v20260311
大小 3.48KB
更新时间 2026-03-12
语言