preloadTranslation

See source code

Starts loading the UI translation for a locale, so that the tldraw UI renders in that language from its first frame instead of in English while it fetches. Call it as soon as you know the user's locale, and await it if you'd rather show nothing than briefly show English.

Pass the same assetUrls you pass to <Tldraw />, if any. The promise never rejects: if the catalog fails to load, the UI tries again when it mounts and falls back to English.

function preloadTranslation(
  locale: TLUiTranslation["locale"],
  assetUrls?: TLUiAssetUrlOverrides,
): Promise<void>;

Example

await preloadTranslation("fr");

Parameters

NameDescription

locale

TLUiTranslation["locale"];

assetUrls

Returns

Promise<void>;
Prev
preloadFont
Next
putExcalidrawContent