v148 · AI · Web APIs

Batch Translator

Translate a list of strings in parallel using a single Translator instance. Useful for UI strings, product descriptions, comments — anything where you have many items and want them all translated without separate API calls per item.

Checking Translator API support…
Each line is translated as an independent string — all fired in parallel.

Batch translation pattern

// Create one Translator, translate all strings in parallel
const translator = await Translator.create({
  sourceLanguage: 'en',
  targetLanguage: 'es',
});

const strings = [
  'Welcome', 'Settings', 'Profile', 'Sign out', /* ... */
];

// All fired at once — model handles them concurrently
const translations = await Promise.all(
  strings.map(s => translator.translate(s))
);

// Cleanup
translator.destroy();

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗