New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

bunta/translations

Translation trait
9
Install
composer require bunta/translations:dev-master
License:MIT
Last Updated:Aug 5, 2016
Links: GitHub  ·  Packagist
Maintainer: aanyszek

translations

instalation

add to "\config\app.php":

'providers' => [
    ...
    Bunta\Translations\TranslationsServiceProvider::class
    ...
],

add to "\app\SomeModel.php":

...
use \Bunta\Translations\TranslationsTrait;
...
public $translatedAttributes = ['nameVirtualAttributeToTranslate'];
...

run comands

composer du
php artisan optimize 
php artisan vendor:publish
php artisan migrate

Usage

Access to right translate

$model->nameVirtualAttributeToTranslate; 

Access to all translates

@foreach(Config::get('translations.locales') as $lang)
    {!! Form::text("nameVirtualAttributeToTranslate[$lang]",$model->translation('nameVirtualAttributeToTranslate',$lang)) !!}
@endforeach 

save translate

 Model::create($request->all());

Related Packages

hyperf/translation

An independent translation component, forked by illuminate/translation.

2,409,071 7
jildertmiedema/translation-check

Checks if all translation items appear in all languages

783 1
exolnet/laravel-translation-editor

Allow translation edition through the browser

42,978 6
bluora/laravel-yandex-translate

Translate a word or text to a given language using Yandex Translation service.

25,534 9