Content blocks
Fetching translations
Section titled “Fetching translations”$translations = $client->getTranslations('es-es');// [ 'UI' => ['Home' => 'Inicio', ...], '__uncategorized__' => [...] ]
$resource = $client->translations();$stats = $resource->getStats('es-es');$response = $resource->getFlat('es-es'); // includes status, words, untranslated, datatranslateContentBlock()
Section titled “translateContentBlock()”translateContentBlock() translates HTML content and automatically queues new content blocks for registration:
$client->setLocale('es-es');$html = '<p><a href="#">Click here</a> to learn more</p>';
$translated = $client->translateContentBlock($html);$translated = $client->translateContentBlock($html, 'homepage');$translated = $client->translateContentBlock('<p>Hi {name}</p>', 'homepage', ['name' => 'Sarah']);This uses the same phrase extraction logic as registerContentBlock(). To register without translating, see Registration.