Everything you need to translate your website with one line of code.
Add this script tag to your HTML. That's it.
<script src="https://tongues.80x24.ai/t.js" data-lang="en" defer></script>
Set data-lang to your page's language. When a visitor's browser matches, auto-translate is skipped (zero API calls). When it doesn't match, tongues translates automatically. No UI injected. No build step.
The script above always loads the latest version. If you need a fixed version that won't change:
<script src="https://tongues.80x24.ai/t@1.0.0.js" defer></script>
Pinned versions are cached aggressively (immutable). Upgrade by changing the version number when you're ready.
navigator.languagedata-lang)Tell tongues what language your page is written in:
<script src="https://tongues.80x24.ai/t.js" data-lang="ko" defer></script>
When data-lang matches the visitor's browser locale (base language comparison — ko-KR matches ko), auto-translate is skipped entirely. Zero API calls. When the locale differs, translation runs normally.
window.t.sourceLocale returns the data-lang value. setLocale() still works for manual translation even when auto-translate is skipped.
Without data-lang, tongues auto-detects the source language via heuristic — but setting it explicitly is recommended for best results and zero-cost same-language visits.
tongues exposes a global window.t object for programmatic control.
data-lang value if set, otherwise the detected browser locale.translate="no" while respecting inner descendants'. Pass { to: "ko" } to translate to a specific locale without changing global state. When to matches source language, restores original text without API call.// Simple language picker
const langs = ["en", "ja", "zh", "ko", "es"];
langs.forEach(lang => {
const btn = document.createElement("button");
btn.textContent = lang.toUpperCase();
btn.onclick = () => window.t.setLocale(lang);
document.getElementById("lang-picker").append(btn);
});
By default, tongues auto-translates the page on load based on the visitor's browser language. If you want full control over when translation starts, add the data-manual attribute:
<script data-manual src="https://tongues.80x24.ai/t.js" defer></script>
In manual mode, tongues loads and sets up the MutationObserver, but does not translate on page load. Call t.setLocale() to trigger translation when you're ready:
// User clicks a language button
document.getElementById("lang-ko").onclick = () => {
window.t.setLocale("ko");
};
This is useful when you need to wait for user interaction, load data first, or build a custom language picker. The window.t API works the same in both modes.
tongues automatically reads your page's <title> and <meta name="description"> to understand context. For extra precision, add a data-preprompt attribute with a short hint (max 30 characters):
<script src="https://tongues.80x24.ai/t.js" data-preprompt="음식 메뉴 번역" defer></script>
The hint is injected into the AI's system prompt as a Note directive. This helps resolve ambiguous terms. For example:
data-preprompt="야구 뉴스 사이트" — "The pitch was perfect" → 투구가 완벽했습니다data-preprompt="비즈니스 컨설팅" — "The pitch was perfect" → 제안이 완벽했습니다data-preprompt="맥주 양조장" — "The draft is ready" → 생맥주가 준비되었습니다data-preprompt="블로그 에디터" — "The draft is ready" → 초안이 준비되었습니다Without data-preprompt, tongues still works — it uses page title and description for context. The preprompt adds an explicit layer for sites where domain-specific vocabulary matters.
All three context sources coexist in the system prompt:
pageTitle — from <title> (automatic)pageDescription — from <meta name="description"> (automatic)preprompt — from data-preprompt attribute (manual, max 30 chars)They don't replace each other. Page metadata provides implicit context, while preprompt is your explicit instruction to the translator.
Prevent specific elements from being translated:
<!-- HTML5 standard -->
<span translate="no">MenuPie</span>
<!-- Google Translate convention (also works) -->
<code class="notranslate">npm install</code>
Both translate="no" and .notranslate are respected. Children of excluded elements are also skipped. Use t.translateEl() to explicitly translate excluded elements when needed.
Use translate="no" to exclude elements from automatic translation. Then use t.translateEl() to translate them on demand.
translate="no"Excludes an element and its children from all automatic translation — page load, setLocale(), and MutationObserver. Only t.translateEl() can translate it.
<nav>UI translates automatically</nav>
<main translate="no">Content stays original until you say so</main>
translateEl() and translate="no"When you call t.translateEl(root), the root element's translate="no" is bypassed. But translate="no" on inner descendants is still respected — protecting code blocks, brand names, etc.
<main translate="no">
<p>This gets translated by translateEl()</p>
<pre translate="no"><code>const x = 1;</code></pre> <!-- still protected -->
</main>
// Globe button clicked → translate content
await t.translateEl("main");
// main's translate="no" bypassed, inner <pre translate="no"> protected
A common pattern is auto-translating UI while keeping content in the original language until the user explicitly switches:
<script src="https://tongues.80x24.ai/t.js" data-lang="en" defer></script>
<nav>Menu items</nav> <!-- auto-translated on load -->
<main translate="no">Content</main> <!-- stays original -->
// User clicks globe → translate content only (UI untouched)
async function onLanguageChange(lang) {
await t.translateEl("main", { to: lang });
}
// Restore content to original — no API call
await t.translateEl("main", { to: t.sourceLocale });
With { to }, you don't need setLocale(). Global locale stays unchanged — only the target element is translated to the specified language.
If you want both UI and content to translate together:
async function onLanguageChange(lang) {
await t.setLocale(lang); // translate UI
await t.translateEl("main"); // translate content (uses current locale)
}
translate="no", translate when showntranslate="no" inside translatable areas to protect code// Modal opens → translate its content
document.getElementById("modal").showModal();
await t.translateEl("#modal");
tongues uses a MutationObserver to detect DOM changes. When your framework (React, Svelte, Vue, etc.) adds or updates content, tongues automatically translates it.
Translations are cached at multiple layers for speed and cost efficiency:
Cache keys are based on the original text content. If you change the text on your site, the cache automatically invalidates — no manual purging needed.
tongues uses Claude AI for translation, which supports virtually any language. Just pass any valid locale code to t.setLocale() — no predefined list required.
Register your domain and check usage on the dashboard.