{"id":38948912,"url":"https://github.com/lingodotdev/sdk-deno","last_synced_at":"2026-01-17T16:07:08.813Z","repository":{"id":308553308,"uuid":"1031828016","full_name":"lingodotdev/sdk-deno","owner":"lingodotdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-26T14:10:26.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-26T18:38:00.722Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lingodotdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-04T11:47:58.000Z","updated_at":"2025-08-26T14:10:06.000Z","dependencies_parsed_at":"2025-08-06T16:06:59.886Z","dependency_job_id":"e10066ed-3942-4fab-9b52-7f75d3e66049","html_url":"https://github.com/lingodotdev/sdk-deno","commit_stats":null,"previous_names":["lingodotdev/sdk-deno"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lingodotdev/sdk-deno","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingodotdev%2Fsdk-deno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingodotdev%2Fsdk-deno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingodotdev%2Fsdk-deno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingodotdev%2Fsdk-deno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lingodotdev","download_url":"https://codeload.github.com/lingodotdev/sdk-deno/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingodotdev%2Fsdk-deno/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-17T16:07:08.738Z","updated_at":"2026-01-17T16:07:08.794Z","avatar_url":"https://github.com/lingodotdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lingo.dev Deno SDK\n\nA powerful, dependency-free Deno SDK for the Lingo.dev localization platform. Optimized for Edge Runtime environments and Supabase Functions.\n\n## Features\n\n- 🌐 **Complete localization support**: Text, objects, chat sequences, HTML documents\n- 🚀 **Edge Runtime optimized**: Works perfectly in Supabase Edge Functions, Deno Deploy, and Cloudflare Workers\n- � **Zero dependencies**: No external dependencies, uses only Deno's built-in APIs\n- 🎯 **TypeScript first**: Full TypeScript support with comprehensive type definitions\n- ⚡ **Fast and efficient**: Intelligent batching and chunking for optimal performance\n- 🛑 **Cancellation support**: AbortController support for request cancellation\n- 📊 **Progress tracking**: Real-time progress callbacks for long-running translations\n- 🔄 **Multiple formats**: Support for text, objects, arrays, chat, and HTML\n- 🌍 **Language detection**: Automatic language detection capabilities\n- 🎨 **HTML preservation**: Translate HTML while preserving structure and formatting\n\n## Installation\n\n### From JSR (Recommended)\n\n```typescript\nimport { LingoDotDevEngine } from \"jsr:@lingo.dev/sdk-deno\";\n```\n\n### From GitHub\n\n```typescript\nimport { LingoDotDevEngine } from \"https://deno.land/x/lingo_sdk/mod.ts\";\n```\n\n### Direct import\n\n```typescript\nimport { LingoDotDevEngine } from \"https://raw.githubusercontent.com/lingodotdev/sdk-deno/main/mod.ts\";\n```\n\n## Quick Start\n\n```typescript\nimport { LingoDotDevEngine } from \"jsr:@lingo.dev/sdk-deno\";\n\n// Initialize the engine\nconst engine = new LingoDotDevEngine({\n  apiKey: \"your-api-key-here\", // Get from https://lingo.dev\n});\n\n// Translate text\nconst result = await engine.localizeText(\"Hello, world!\", {\n  sourceLocale: \"en\",\n  targetLocale: \"es\",\n});\n\nconsole.log(result); // \"¡Hola, mundo!\"\n```\n\n## Usage Examples\n\n### Text Translation\n\n```typescript\nconst translation = await engine.localizeText(\"Welcome to our app\", {\n  sourceLocale: \"en\",\n  targetLocale: \"fr\",\n});\n// Result: \"Bienvenue dans notre application\"\n```\n\n### Object Translation\n\n```typescript\nconst uiStrings = {\n  welcome: \"Welcome to our app\",\n  buttons: {\n    save: \"Save\",\n    cancel: \"Cancel\",\n    delete: \"Delete\",\n  },\n  messages: {\n    success: \"Operation completed successfully\",\n    error: \"An error occurred\",\n  },\n};\n\nconst translated = await engine.localizeObject(uiStrings, {\n  sourceLocale: \"en\",\n  targetLocale: \"es\",\n});\n```\n\n### Batch Translation\n\n```typescript\nconst results = await engine.batchLocalizeText(\"Hello\", {\n  sourceLocale: \"en\",\n  targetLocales: [\"es\", \"fr\", \"de\", \"it\"],\n});\n// Results: [\"Hola\", \"Bonjour\", \"Hallo\", \"Ciao\"]\n```\n\n### Chat Translation\n\n```typescript\nconst chat = [\n  { name: \"Alice\", text: \"Hello everyone!\" },\n  { name: \"Bob\", text: \"How are you doing?\" },\n  { name: \"Charlie\", text: \"Great to see you!\" },\n];\n\nconst translatedChat = await engine.localizeChat(chat, {\n  sourceLocale: \"en\",\n  targetLocale: \"es\",\n});\n// Preserves speaker names while translating text\n```\n\n### HTML Translation\n\n```typescript\nconst html = `\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eMy Website\u003c/title\u003e\n    \u003cmeta name=\"description\" content=\"Welcome to my site\"\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eHello World\u003c/h1\u003e\n    \u003cp\u003eThis is a \u003ca href=\"#\" title=\"Link title\"\u003elink\u003c/a\u003e\u003c/p\u003e\n    \u003cimg src=\"image.jpg\" alt=\"Image description\"\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n`;\n\nconst translatedHtml = await engine.localizeHtml(html, {\n  sourceLocale: \"en\",\n  targetLocale: \"es\",\n});\n// Translates text content and localizable attributes while preserving HTML structure\n```\n\n### String Array Translation\n\n```typescript\nconst fruits = [\"apple\", \"banana\", \"orange\", \"grape\"];\nconst translatedFruits = await engine.localizeStringArray(fruits, {\n  sourceLocale: \"en\",\n  targetLocale: \"ja\",\n});\n// Result: [\"りんご\", \"バナナ\", \"オレンジ\", \"ぶどう\"]\n```\n\n### Language Detection\n\n```typescript\nconst locale = await engine.recognizeLocale(\"Bonjour le monde\");\nconsole.log(locale); // \"fr\"\n```\n\n### Progress Tracking\n\n```typescript\nconst result = await engine.localizeText(\"Large text content...\", {\n  sourceLocale: \"en\",\n  targetLocale: \"de\",\n}, (progress) =\u003e {\n  console.log(`Translation progress: ${progress}%`);\n});\n```\n\n### Request Cancellation\n\n```typescript\nconst controller = new AbortController();\n\n// Cancel after 10 seconds\nsetTimeout(() =\u003e controller.abort(), 10000);\n\ntry {\n  const result = await engine.localizeText(\n    \"Some text\",\n    {\n      sourceLocale: \"en\",\n      targetLocale: \"zh\",\n    },\n    undefined,\n    controller.signal,\n  );\n} catch (error) {\n  if (error.name === \"AbortError\") {\n    console.log(\"Translation was cancelled\");\n  }\n}\n```\n\n## Supabase Edge Functions\n\nPerfect for Supabase Edge Functions:\n\n```typescript\n// supabase/functions/translate/index.ts\nimport { serve } from \"https://deno.land/std@0.168.0/http/server.ts\";\nimport { LingoDotDevEngine } from \"jsr:@lingo.dev/sdk-deno\";\n\nconst engine = new LingoDotDevEngine({\n  apiKey: Deno.env.get(\"LINGO_API_KEY\")!,\n});\n\nserve(async (req) =\u003e {\n  if (req.method === \"OPTIONS\") {\n    return new Response(null, {\n      status: 200,\n      headers: {\n        \"Access-Control-Allow-Origin\": \"*\",\n        \"Access-Control-Allow-Methods\": \"POST\",\n        \"Access-Control-Allow-Headers\": \"Content-Type\",\n      },\n    });\n  }\n\n  try {\n    const { text, sourceLocale, targetLocale } = await req.json();\n\n    const result = await engine.localizeText(text, {\n      sourceLocale,\n      targetLocale,\n    });\n\n    return new Response(JSON.stringify({ translation: result }), {\n      headers: {\n        \"Content-Type\": \"application/json\",\n        \"Access-Control-Allow-Origin\": \"*\",\n      },\n    });\n  } catch (error) {\n    return new Response(JSON.stringify({ error: error.message }), {\n      status: 500,\n      headers: {\n        \"Content-Type\": \"application/json\",\n        \"Access-Control-Allow-Origin\": \"*\",\n      },\n    });\n  }\n});\n```\n\n## Configuration Options\n\n```typescript\nconst engine = new LingoDotDevEngine({\n  apiKey: \"your-api-key\", // Required: Your Lingo.dev API key\n  apiUrl: \"https://engine.lingo.dev\", // Optional: Custom API URL\n  batchSize: 25, // Optional: Max items per batch (1-250)\n  idealBatchItemSize: 250, // Optional: Ideal size per batch item (1-2500)\n});\n```\n\n## Supported Locales\n\nThe SDK supports all major language locales including:\n\n- **English**: `en`, `en-US`, `en-GB`, `en-AU`, `en-CA`, etc.\n- **Spanish**: `es`, `es-ES`, `es-MX`, `es-AR`, etc.\n- **French**: `fr`, `fr-FR`, `fr-CA`, `fr-BE`, etc.\n- **German**: `de`, `de-DE`, `de-AT`, `de-CH`\n- **Chinese**: `zh`, `zh-CN`, `zh-HK`, `zh-TW`\n- **Japanese**: `ja`, `ja-JP`\n- **Korean**: `ko`, `ko-KR`\n- **And many more...**\n\nSee the full list in the [LocaleCode type definition](./src/index.ts).\n\n## Error Handling\n\nThe SDK provides comprehensive error handling:\n\n```typescript\ntry {\n  const result = await engine.localizeText(\"Hello\", {\n    sourceLocale: \"en\",\n    targetLocale: \"invalid-locale\",\n  });\n} catch (error) {\n  if (error.message.includes(\"Server error\")) {\n    // Handle server errors (5xx)\n    console.log(\"Server is temporarily unavailable\");\n  } else if (error.message.includes(\"Invalid request\")) {\n    // Handle client errors (4xx)\n    console.log(\"Invalid request parameters\");\n  } else if (error.name === \"AbortError\") {\n    // Handle cancelled requests\n    console.log(\"Request was cancelled\");\n  } else {\n    // Handle other errors\n    console.log(\"Translation failed:\", error.message);\n  }\n}\n```\n\n## API Reference\n\n### LingoDotDevEngine\n\nThe main class for interacting with the Lingo.dev API.\n\n#### Constructor\n\n```typescript\nnew LingoDotDevEngine(config: EngineParams)\n```\n\n#### Methods\n\n- `localizeText(text, params, progressCallback?, signal?)` - Translate a text string\n- `localizeObject(object, params, progressCallback?, signal?)` - Translate an object\n- `localizeStringArray(strings, params)` - Translate an array of strings\n- `localizeChat(chat, params, progressCallback?, signal?)` - Translate a chat sequence\n- `localizeHtml(html, params, progressCallback?, signal?)` - Translate HTML content\n- `batchLocalizeText(text, params, signal?)` - Translate to multiple languages\n- `recognizeLocale(text, signal?)` - Detect text language\n- `whoami(signal?)` - Get user information\n\n### Types\n\n```typescript\ninterface EngineParams {\n  apiKey: string;\n  apiUrl?: string;\n  batchSize?: number;\n  idealBatchItemSize?: number;\n}\n\ninterface LocalizationParams {\n  sourceLocale: LocaleCode | null;\n  targetLocale: LocaleCode;\n  fast?: boolean;\n  reference?: Record\u003cLocaleCode, Record\u003cstring, unknown\u003e\u003e;\n  hints?: Record\u003cstring, string[]\u003e;\n}\n\ntype LocaleCode = \"en\" | \"es\" | \"fr\" | \"de\" | \"zh\" | \"ja\" | \"ko\" | ...;\n```\n\n## Development \u0026 CI/CD\n\n### GitHub Actions Workflows\n\nThis repository includes comprehensive CI/CD pipelines:\n\n#### Test Workflow (`test.yml`)\n\n- **Triggers**: Pull requests and pushes to main branch\n- **Matrix Testing**: Tests against Deno 1.x and 2.x\n- **Quality Checks**:\n  - Code formatting (`deno fmt --check`)\n  - Linting (`deno lint`)\n  - Type checking (`deno check`)\n  - Unit tests (`deno test`)\n  - Example compilation validation\n  - JSR configuration validation\n\n#### Release Workflow (`release.yml`)\n\n- **Triggers**: Tags starting with `v*` and main branch pushes\n- **Automated Publishing**:\n  - JSR Registry: `@lingodotdev/deno-sdk`\n  - Deno Land: `https://deno.land/x/lingodotdev@vX.X.X`\n- **GitHub Releases**: Automatic release notes generation\n- **Version Management**: Automatic version extraction from git tags\n\n#### Version Bump Workflow (`version-bump.yml`)\n\n- **Trigger**: Manual workflow dispatch\n- **Options**:\n  - Semantic versioning (patch/minor/major)\n  - Custom version specification\n- **Process**:\n  1. Updates `deno.json` version\n  2. Runs full test suite\n  3. Creates git commit and tag\n  4. Triggers release workflow\n\n#### Security Workflow (`security.yml`)\n\n- **Triggers**: Daily schedule, pushes, and pull requests\n- **Security Checks**:\n  - Dependency vulnerability scanning\n  - Secret detection in source code\n  - Security header validation\n  - CodeQL analysis\n\n### Release Process\n\n1. **Automatic Releases**: Push tags like `v1.2.3` to trigger releases\n2. **Manual Version Bump**: Use GitHub Actions → \"Version Bump\" workflow\n3. **Development**: All PRs are automatically tested\n\n### Local Development\n\n```bash\n# Run tests\ndeno task test\n\n# Check formatting\ndeno task fmt\n\n# Lint code\ndeno task lint\n\n# Type check\ndeno task check\n\n# Validate JSR configuration\ndeno publish --dry-run\n```\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.\n\n## Support\n\n- 📚 [Documentation](https://docs.lingo.dev)\n- 💬 [Discord Community](https://discord.gg/lingo-dev)\n- 🐛 [Issue Tracker](https://github.com/lingodotdev/sdk-deno/issues)\n- 📧 [Email Support](mailto:support@lingo.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingodotdev%2Fsdk-deno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flingodotdev%2Fsdk-deno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingodotdev%2Fsdk-deno/lists"}