Skip to content
Back

AI translatePro

Translate a chat message where it sits: choose a language and each sentence is replaced in turn over a faded original, with the detected language, a switch back to the source text and a note naming the model.

oxyn add ai-translate
RO
Rina Okafor#launch · 10:42
Detected English

The launch moves to Tuesday so the EU tax check can finish. Please keep the pricing page in draft until then. I'll send the final copy on Monday afternoon.

Translating to German…
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • Read a message in your language: pick one and the translation streams in place, sentence by sentence over the dimmed original.

When not to use

Installation

AI translate is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add ai-translate

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

German

Translating to German.

RO
Rina Okafor#launch · 10:42
Detected English

The launch moves to Tuesday so the EU tax check can finish. Please keep the pricing page in draft until then. I'll send the final copy on Monday afternoon.

Translating to German…
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Side by side

Japanese beside the original (Oxyn extra).

RO
Rina Okafor#launch · 10:42
Detected English
English

The launch moves to Tuesday so the EU tax check can finish. Please keep the pricing page in draft until then. I'll send the final copy on Monday afternoon.

Japanese

The launch moves to Tuesday so the EU tax check can finish. Please keep the pricing page in draft until then. I'll send the final copy on Monday afternoon.

Translating to Japanese…
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Failed

Couldn't translate, with Try again.

RO
Rina Okafor#launch · 10:42
Detected English

The launch moves to Tuesday so the EU tax check can finish. Please keep the pricing page in draft until then. I'll send the final copy on Monday afternoon.

Translating to French…
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

AiTranslate

PropTypeDefaultDescription
nowrequiredClockMs—Host clock.
langusize1Starting language (0 original English, 1 German, 2 French, 3 Spanish, 4 Japanese, 5 Portuguese); anything but 0 translates on mount.
failboolDefault::default()The first translation fails (Retry demo).
sideboolDefault::default()Show the original and the translation side by side (Oxyn extra).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterorSpaceor↓Open the language menu
↑or↓ · HomeorEndMove in the menu
EnterPick a language
EscapeClose the menu

Accessibility

  • The menu is a listbox with aria-selected; the text carries a lang attribute for the language shown.
  • Translating, done and errors are announced; the error uses role alert.
  • Show original and side by side are toggle buttons.
From the spec

Language picker is a listbox; Show original is a switch; the status line is polite live. Every action returns the line the polite live region announces. The focus outline shows only for keyboard focus.

Motion & interaction

Each sentence replaces its dimmed original as it lands; the detected-language chip sits by the language picker.

Timing

Everything on screen is derived from the host clock now (no timers in the component), so playback, tests and the GPUI view agree.

TransitionDurationEasing
Think450 ms—
Stream34 ms per ticklinear

Reduced motion: streamed text and moves appear at their end state; progress still advances, without travel animation.

Responsive behaviour

  • Each finished sentence replaces one dimmed sentence, so the card does not jump.
  • Side by side stacks under 520 px.
Edge cases (spec)

Japanese and German lengths differ; the card grows smoothly. Side by side stacks under 640 px. Checked at 1440, 768 and 390 px in light and dark with no text overlap. Chrome is monochrome grey; colour is semantic only (success, warning, danger, info) plus the providers' coloured brand marks.

Notes for AI

  • Import AiTranslate from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: AiKitView in oxyn_gpui.
  • Props to set first: now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI