Welcome Guest, Not a member yet? Register   Sign In
In-model content translations for CodeIgniter 4
#1

This library makes it easier to manage in-model translations for multilingual applications. It integrates with CodeIgniter's model system and allows for storing translations in a separate table while keeping the base entity intact. It provides a simple skeleton generator to kick-start the process.

GitHub Repository: codeigniter-translatable

Installation:
Code:
composer require michalsn/codeigniter-translatable

Example Usage:
PHP Code:
use App\Models\ArticleModel;

$articleModel model(ArticleModel::class);

// Retrieve translations
$article $articleModel->find(1);
echo 
$article->author;
// Default locale translation
echo $article->translate()->title;

// Add a new translation
$article->translate('fr')->title 'Titre en Français';

// Save changes
$articleModel->save($article); 

Docs:
https://michalsn.github.io/codeigniter-translatable/
michalsn.dev - mostly about CodeIgniter
Reply




Theme © iAndrew 2016 - Forum software by © MyBB