Releases: vinkla/laravel-translator
2.0.1
1.3.1
2.0.0
Add fallback support
Fetch the default translation if the current locale doesn't have any translated attributes yet. In the example below the current article doesn't have have the title attribute translated to Swedish yet.
App::setLocale('en');
echo $article->title; // return 'Five Ants Are More than Four Elephants'
App::setLocale('sv');
echo $article->title; // returns 'Five Ants Are More than Four Elephants'
This can be turned off/on in the config.php
file.
Add possibility to fetch a specific translation
Add support to fetch a specific translation with the translate method.
$article->translate('sv')->title;
Rename Key to Column
This release renames the configuration property from key
to column
.
First stable version
This version is rewritten from the ground up. The session driver is removed and the documentation is updated.
Fix of crucial bug
This is a bugfix release. The locales migration used increment
instead of increments
.
Add locales migration
This example migration comes out of the box with this package. Run the command below to add it to your projects database.
php artisan migrate --package="vinkla/translator"
Add save, update and fill methods to the trait
It is now possible to save translated attributes on the base model. In the example below title
and content
are translateable attributes. The image
attribute exists on the base model.
$title = 'Goa gubbar från Göteborg';
$content = 'Brödtext översatt på svenska.';
$image = 'weird-cat.jpg';
$article->update(compact('title', 'content', 'image'));
The translator package can now identify translateable attributes and save them in the current language. It compares fillable attributes with the translatedAttributes
array that is set on our base model.