Skip to content
✈️ TokenFlight SDK

Internationalization (i18n)

TokenFlight includes built-in translations for five locales. Language packs are lazy-loaded — only the active locale is bundled into the page.

CodeLanguage
en-USEnglish (default)
zh-CNSimplified Chinese (简体中文)
zh-TWTraditional Chinese (繁體中文)
ja-JPJapanese (日本語)
ko-KRKorean (한국어)
<tokenflight-swap locale="zh-CN" theme="dark"></tokenflight-swap>
import { TokenFlightSwap } from '@tokenflight/swap';
const swap = new TokenFlightSwap({
container: '#swap',
config: {
locale: 'ja-JP',
theme: 'dark',
},
});
swap.initialize();
import { TokenFlightReceive } from '@tokenflight/swap';
const receive = new TokenFlightReceive({
container: '#receive',
config: {
target: { chainId: 8453, address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' },
amount: '100',
locale: 'zh-CN',
theme: 'dark',
},
});
receive.initialize();

All user-visible text in the widget UI is localized:

  • Swap flow — “You pay”, “You receive”, “Select token”, “Connect Wallet”, “Review Swap”, “Confirm Swap”, success/error messages
  • Receive flow — “You receive”, “Pay with”, “Browse all tokens”, “BEST” badge
  • Token selector — “Search by name or address”, “All Chains”, “No tokens found”
  • Errors — “Wallet not connected”, “Insufficient balance”, “Transaction failed”, etc.
  • Number formatting — amounts and fiat values respect Intl.NumberFormat for the active locale