TransDuck Variables DemoDynamic values stay untranslated — only the surrounding text changes
Names, dates, prices, and other runtime values are passed via vars= and inserted
after translation. The AI translates the template, the placeholders stay intact.
| Template | Variables | English |
|---|
# Variables are passed separately — never baked into the source string from datetime import date from babel.dates import format_date from transduck import ait # Format dates in the user's locale with Babel checkin = format_date(date(2026, 3, 21), format="long", locale="de_DE") checkout = format_date(date(2026, 3, 28), format="long", locale="de_DE") # checkin = "21. März 2026", checkout = "28. März 2026" # Pass the locale-formatted dates as variables ait( "{property} is fully booked from {checkin} to {checkout}", vars={"property": "Hotel Marimar", "checkin": checkin, "checkout": checkout} ) # → "Hotel Marimar ist vom 21. März 2026 bis 28. März 2026 vollständig ausgebucht" # The AI translates the template, placeholders stay put ait( "Your flight to {destination} departs at {time}", vars={"destination": "Mallorca", "time": "14:30"} ) # DE → "Ihr Flug nach Mallorca startet um 14:30" # IT → "Il tuo volo per Mallorca parte alle 14:30"
Dates, numbers, and currencies can also be formatted client-side using the browser's built-in
Intl API — no translation needed. These update automatically based on the selected locale.
Rendered client-side with Intl.DateTimeFormat, Intl.NumberFormat,
and Intl.RelativeTimeFormat using locale .
<!-- The browser formats dates, numbers, and currencies natively --> <!-- No translation API needed — just set the locale --> <p id="check-in-date"></p> <p id="room-price"></p> <script> const locale = "de-DE"; // or "ar-SA", "it-IT", "ru-RU" // Date: "21. März 2026" (DE) or "21 marzo 2026" (IT) document.getElementById("check-in-date").textContent = new Intl.DateTimeFormat(locale, { dateStyle: "long" }) .format(new Date(2026, 2, 21)); // Currency: "1.249,50 €" (DE) or "1.249,50 €" (IT) document.getElementById("room-price").textContent = new Intl.NumberFormat(locale, { style: "currency", currency: "EUR" }) .format(1249.50); </script>