Implements and debugs browser Translator API integrations in JavaScript or TypeScript web apps. Use when adding Translator support checks, language-pair availability flows, model download UX, session creation, translate() or translateStreaming() calls, input-usage measurement, or permissions-policy handling for on-device translation. Don't use for server-side translation SDKs, cloud translation services, or generic multilingual content pipelines.
67
81%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
—
The risk profile of this skill
Step 1: Identify the browser integration surface
node scripts/find-translator-targets.mjs . to inventory likely frontend files and existing Translator API markers when a Node runtime is available.package.json, HTML entry point, and framework bootstrap files manually to identify the browser app boundary.Step 2: Confirm API viability and choose the integration shape
references/translator-reference.md before writing code.references/examples.md when the feature needs a session wrapper, download-progress UI, streaming output, cancellation, or cleanup shape.references/compatibility.md when preview flags, browser channels, iframe rules, or environment constraints matter.references/troubleshooting.md when support checks, session creation, translation, or cleanup fail.Window context.translator permissions-policy feature.Translator.create() for a fixed language pair and full-result translationcreate() when the UI must surface model download progresstranslateStreaming() when the UI should reveal translated output incrementallymeasureInputUsage() when quota or input-size budgeting affects the flowStep 3: Implement a guarded translator session
assets/translator-session.template.ts and adapt it to the framework, state model, and file layout in the workspace.globalThis.isSecureContext, Translator, and the same sourceLanguage and targetLanguage shape the feature will use at runtime.Translator.availability() using the same language pair that will be passed to Translator.create().availability() as a capability check, not a guarantee that creation will succeed without download time, policy approval, or user activation.monitor option during create() when the product needs download progress.AbortController for cancelable create(), translate(), translateStreaming(), or measureInputUsage() calls, and call destroy() when the session is no longer needed.sourceLanguage or targetLanguage after creation; session options are fixed per instance.allow="translator".Step 4: Wire UX and fallback behavior
translate() when downstream logic needs the full result before continuing, and use translateStreaming() when the UI should reveal translated text incrementally.measureInputUsage() when large inputs can exceed session quota.Step 5: Validate behavior
node scripts/find-translator-targets.mjs . to confirm that the intended app boundary and Translator API markers still resolve to the edited integration surface.Translator feature detection, and availability() behavior before debugging deeper runtime failures.create() plus translate() flow with representative user text for the target language pair.translateStreaming() separately and confirm partial output stops cleanly on abort.measureInputUsage() behavior before sending large input.references/compatibility.md before treating failures as application bugs.Translator is missing, keep a non-AI fallback and confirm secure-context, browser, channel, and flag requirements before changing product logic.availability() returns downloadable or downloading, require user-driven session creation before promising that translation is ready.create() throws NotAllowedError, check permissions-policy constraints, missing user activation for downloads, browser policy restrictions, or user rejection.create() throws OperationError, treat model initialization as failed and retry only after checking browser state, required flags, and download readiness.QuotaExceededError, reduce the input size or measure usage before retrying.NotReadableError or UnknownError, surface a visible fallback instead of retrying blindly with the same input.f4c5a23
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.