Download the PHP package marshmallow/translatable without Composer
On this page you can find all versions of the php package marshmallow/translatable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marshmallow/translatable
More information about marshmallow/translatable
Files in marshmallow/translatable
Package translatable
Short Description Add translation to your Nova Resources. The translations will be stored in a translatables table and not in a JSON format in your existing tables as many packages out there do.
License MIT
Homepage https://marshmallow.dev
Informations about the package translatable

Nova Translatable
Add translation to your Nova Resources. The translations will be stored in a translatables table and not in a JSON format in your existing tables as many packages out there do.
Installation
You can install the package via composer:
Publish the configuration:
Run the install command. This updates config/app.php, syncs your existing language files into the database, syncs inline translations and generates the Nova resources:
Manual Installation
If you prefer to install manually or the automatic installation doesn't work for your setup, follow these steps:
1. Add Default Locale Configuration
Add the following line to your config/app.php file, right after the 'locale' configuration:
2. Set Environment Variable
Make sure you have the APP_LOCALE environment variable set in your .env file:
3. Run Migration and Synchronization Commands
Usage
Please reference the official documentation at Marshmallow Documentation.
Make a model translatable
Add the Translatable trait to any Eloquent model whose attributes you want to translate. When the trait is enabled, translated values are stored in the translatables table and the translatable relationship is eager loaded automatically to avoid N+1 queries.
Use Deepl integration
This package contains an integration with Deepl. This integration will add a button to the translations index view, that will automaticly translate your text via Deepl. Just add the following ENV variable to use this awesome feature.
This will use the free version of the Deepl API. If you have a paid subscription, you can add the following as well.
Configuration
After publishing, the configuration lives in config/translatable.php:
| Key | Default | Description |
|---|---|---|
driver |
database |
Translation storage driver. Supported: file, database. Migrations are only loaded when set to database. |
nova_translatable_fields |
true |
Show the language selector when editing a resource in Laravel Nova. |
flag_icon |
['height' => 40, 'width' => 40] |
Ratios for the flag uploader. |
translation_methods |
['trans', '__'] |
Methods the scanner looks for when finding missing translations. |
scan_paths |
[app_path(), resource_path()] |
Directories scanned when looking for missing translations. |
models |
Language, Translation, Translatable, MissingTranslation |
Model classes used by the package. Override to swap in your own. |
force_locale_query_string |
force_locale |
Query string parameter that forces the locale, useful for testing and deep linking. |
deepl.api_path |
env('TRANSLATABLE_DEEPL_API_PATH', 'https://api-free.deepl.com') |
Deepl API endpoint. |
deepl.api_key |
env('TRANSLATABLE_DEEPL_API_KEY') |
Deepl API key. |
auto_translator.active |
env('TRANSLATABLE_AUTO_TRANSLATOR_ACTIVE', false) |
Enable the auto-translator. |
missing_translations.active |
env('MISSING_TRANSLATIONS_ACTIVE', false) |
Enable missing-translation tracking. |
Artisan Commands
The package ships the following Artisan commands:
| Command | Description |
|---|---|
translatable:install |
Install the package: update config, sync files to database and generate Nova resources. |
translatable:add-language |
Add a new language. |
translatable:add-translation-key |
Add a new translation key. |
translatable:list-languages |
List the configured languages. |
translatable:list-missing |
List missing translation keys. |
translatable:sync-file-to-database |
Sync existing language files into the database. |
translatable:sync-missing |
Sync missing translation keys. |
translatable:sync-translations |
Synchronise translations. |
translatable:duplicates |
Find duplicate translations. |
translatable:fix-placeholders |
Fix translated placeholders. |
translatable:generate-preset |
Generate a preset. |
translatable:preset |
Apply a preset. |
translatable:index-missing-translatables |
Index missing translatables. |
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Stef van Esch
- All Contributors
- joedixon
License
The MIT License (MIT). Please see License File for more information.
All versions of translatable with dependencies
laravel/nova Version ^4.0|^5.0
marshmallow/commands Version ^v1.2.1
marshmallow/helpers Version ^v2.11.1
marshmallow/live-update Version ^v2.0
marshmallow/nova-advanced-image Version ^v2.0
marshmallow/sluggable Version ^v1.3.0
spatie/laravel-package-tools Version ^1.13