跳到内容
Sonenta
← All capabilities

Tutorials · for developers

Translate your app with Sonenta

A scenario-based walkthrough. Every tutorial has two parts: Integration & init (get Sonenta wired into your repo) and a work sequence (the AI prompts and reviews that get the job done). The commands and prompts are exact, copy them straight in.

v1 covers Translation. More scenarios (accessibility, evaluation, delivery) land after this format is validated.

Part A

Integration & init

  1. 1. Install the CLI

    shell
    npm install -g @sonenta/cli      # provides the `sonenta` command
  2. 2. Authenticate

    Create an API key in the dashboard (Settings → API keys) with the mcp:* scope so the local-AI agents can act.

    shell
    sonenta login --token snt_live_<prefix>.<secret>
    # --host defaults to https://api.sonenta.dev
  3. 3. Initialize the project

    Run in your repo root. This scaffolds sonenta.config.json, a managed block in CLAUDE.md / AGENTS.md so your local AI knows the project, and auto-wires the MCP server into .mcp.json (secret-free, the server reads credentials from your sonenta login). In Claude Code, quit your session and start a fresh one afterward: Claude Code reads .mcp.json when the session starts, so a session that was already open keeps running without the Sonenta tools.

    shell
    sonenta init --project <PROJECT_UUID>
    sonenta.config.json
    {
      "host": "https://api.sonenta.dev",
      "project_uuid": "<PROJECT_UUID>",
      "version_slug": "main"
    }
    .mcp.json
    {
      "mcpServers": {
        "sonenta": {
          "command": "npx",
          "args": ["-y", "@sonenta/mcp"],
          "env": {
            "SONENTA_BASE_URL": "https://api.sonenta.dev",
            "SONENTA_PROJECT": "<PROJECT_UUID>"
          }
        }
      }
    }
  4. 4. Install the local-AI agent

    Writes .claude/agents/sonenta-i18n.md and ensures .mcp.json is wired. sonenta agents list shows all bundled agents, e.g. sonenta-a11y.

    shell
    sonenta agents add sonenta-i18n      # the translation agent
  5. 5. Verify the setup

    shell
    sonenta doctor                       # checks MCP wired, reachable, scoped
  6. 6. Add the runtime SDK

    Wrap your app once with the provider, then render strings with the t() hook as usual. Published translations arrive over the CDN with no code change.

    shell
    npm install @sonenta/react-i18next
    app entry
    import { SonentaProvider } from "@sonenta/react-i18next";
    
    <SonentaProvider
      apiBase="https://api.sonenta.dev"
      projectUuid="<PROJECT_UUID>"
      token="snt_live_<prefix>.<secret>"   // a key with the missing:write scope
      defaultLocale="en"
      namespaces={["common"]}
    >
      <App />
    </SonentaProvider>
    any component
    const { t } = useTranslation();
    return <button>{t("checkout.pay")}</button>;
Part B

The translation workflow

A simple three-step loop: generate drafts, review, publish.

  1. 1. Generate translations (drafts)

    The agent runs locally (0 AI credits): coverage_reportlist_untranslated_keyspropose_translations_bulk, honoring your glossary and project context. The result is draft translations in Sonenta, nothing is live yet.

    Prompt your AI
    Using sonenta-i18n, translate every untranslated key into all my target languages, following my glossary and tone.
  2. 2. Review in Sonenta

    Open the Translations editor in the dashboard (/translations). Approve or edit each draft. Only what you approve becomes publishable.

  3. 3. Publish to the CDN

    The agent calls publish_cdn. Published translations are served from the CDN and picked up automatically by your app through @sonenta/react-i18next, no code change, no redeploy.

    Prompt your AI
    Publish the approved translations to the CDN.

Publishing happens through the agent’s publish_cdn tool (or the prompt above). There is no separate sonenta publish command, the CLI’s push / pull sync local locale files, not the AI-driven flow above.