Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages
T

Translatable Field

This package has been marked as abandoned on Packagist. Please proceed with care.

Installation Instructions

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'),

Defining Locales

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',
]),

Single Line Option

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(),

Trix Editor

You can use the trix editor for your translated fields by using the trix() option:

Translatable::make('Description')->trix(),

Index View

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

Readme not found. Refer to the project website: https://github.com/mrmonat/nova-translatable

Back to Top
Added 8 years ago
Last updated 5 Years Ago
Version 2.2.0
Composer
mrmonat/nova-translatable
GitHub stars 84
Packagist downloads 186,791

Favorites

17 users favorited

Rating

5.00
(out of 5)
★★★★★
★★★★
★★★
★★
★
9 ratings

Author

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas