PHP code example of coding-partners / transla-genius
1. Go to this page and download the library: Download coding-partners/transla-genius 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/ */
coding-partners / transla-genius example snippets
return [
/*
|--------------------------------------------------------------------------
| Supported Languages
|--------------------------------------------------------------------------
| List of supported language codes (ISO 639-1).
| The first language will be considered as default.
*/
'supported_languages' => ['en', 'ar', 'es', 'fr'],
// ... other settings
];
use CodingPartners\TranslaGenius\Traits\Translatable;
class Post extends Model
{
use Translatable;
// Define the fields that should be translated
public $translatable = [
'title',
'content',
];
}
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->json('title');
$table->json('content');
$table->timestamps();
});
use CodingPartners\TranslaGenius\Traits\Translatable;
class Product extends Model
{
use Translatable;
protected $fillable = [
'price',
'name',
'description'
];
public $translatable = [
'name',
'description'
];
}