1. Go to this page and download the library: Download andrewdwallo/transmatic library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
andrewdwallo / transmatic example snippets
use Wallo\Transmatic\Facades\Transmatic;
$translatedText = Transmatic::translate('Hello World', [], 'es'); // Hola Mundo
use Wallo\Transmatic\Facades\Transmatic;
$translatedText = Transmatic::translate(text: 'Hello World', to: 'es'); // Hola Mundo
use Wallo\Transmatic\Facades\Transmatic;
$texts = ['Hello World', 'Goodbye World'];
$translatedTexts = Transmatic::translateMany(texts: $texts, to: 'fr'); // ['Bonjour le monde', 'Au revoir le monde']
use Wallo\Transmatic\Facades\Transmatic;
$translatedText = Transmatic::translate(text: 'Hello :name', replace: ['name' => 'John'], to: 'es'); // Hola John
use Wallo\Transmatic\Facades\Transmatic;
$supportedLocales = Transmatic::getSupportedLocales(); // ['en', 'fr']
$translatedText = translate(text: 'Hello World', to: 'es'); // Hola Mundo
$translatedTexts = translateMany(texts: ['Hello World', 'Goodbye World'], to: 'fr'); // ['Bonjour le monde', 'Au revoir le monde']
use Wallo\Transmatic\Facades\Transmatic;
public function boot()
{
Transmatic::setGlobalLocale(locale: 'fr');
}
use Wallo\Transmatic\Facades\Transmatic;
Transmatic::setGlobalLocale(locale: 'fr');
$translatedText = Transmatic::translate(text: 'Hello World'); // Bonjour le monde
use Wallo\Transmatic\Facades\Transmatic;
Transmatic::setGlobalLocale(locale: 'fr');
$translatedText = Transmatic::translate(text: 'Hello World', to: 'es'); // Hola Mundo
use Wallo\Transmatic\Facades\Transmatic;
public function boot()
{
Transmatic::processMissingTranslationsFor(locales: ['fr', 'de']);
}
use Wallo\Transmatic\Facades\Transmatic;
public function boot()
{
Transmatic::processMissingTranslations();
}