Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Magento script to translate a specific text using the Yireo BingTranslate extension
<?php
// Basic settings
$text = 'Hello World';
$source = 'en';
$destination = 'fr';
// Startup the application
require_once 'app/Mage.php';
Mage::app();
// Call upon the translator-model
$translator = Mage::getSingleton('bingtranslate/translator');
$translation = $translator->translate($text, $source, $destination);
if(!empty($translation)) {
echo $translation."\n";
} else {
echo $translator->getApiError()."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.