PHP code example of ozankurt / laravel-modules-i18n
1. Go to this page and download the library: Download ozankurt/laravel-modules-i18n 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/ */
ozankurt / laravel-modules-i18n example snippets
use Illuminate\Support\Facades\Gate;
Gate::define('i18n.manageTranslations', function ($user) {
return in_array($user->email, ['[email protected]'], true);
});
interface Translator
{
public function translate(string $text, string $from, string $to): string;
}
namespace App\Translation;
use Kurt\Modules\I18n\Contracts\Translator;
final class DeepLTranslator implements Translator
{
public function translate(string $text, string $from, string $to): string
{
// call your provider and return the translated string
}
}