You can require this package using composer:
composer require mrmonat/nova-translatable
You can add the field follows:
use MrMonat\Translatable\Translatable;
Translatable::make('Description'),
Locales can be defined via config file config/translatable.php (config file can be created via spatie/laravel-translatable package) by adding a locales array:
// config/translatable.php
return [
...
'locales' => [
'en' => 'English',
'de' => 'German',
'fr' => 'French',
],
];
Alternatively you can "override" the config locales with the locales(...) method:
Translatable::make('Description')->locales([
'en' => 'English',
'de' => 'German',
]),
By default the input field on the edit view is a textarea. If you want to change it to a single line input field you can add the singleLine option:
Translatable::make('Description')->locales([...])->singleLine(),
You can use the trix editor for your translated fields by using the trix() option:
Translatable::make('Description')->trix(),
By default the locale used when displaying the field on the index view is determined by app()->getLocale(). To override this you can use the indexLocale($locale) option:
Translatable::make('Description')->indexLocale('de'),Readme not found. Refer to the project website: https://github.com/mrmonat/nova-translatable
| Added | 8 years ago |
| Last updated | 5 Years Ago |
| Version | 2.2.0 |
| Composer | |
| mrmonat/nova-translatable | |
| GitHub stars | 84 |
| Packagist downloads | 186,791 |