Download the PHP package filament/spatie-laravel-translatable-plugin without Composer

On this page you can find all versions of the php package filament/spatie-laravel-translatable-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package spatie-laravel-translatable-plugin

Filament Spatie Translatable Plugin

Installation

Install the plugin with Composer:

Adding the plugin to a panel

To add a plugin to a panel, you must include it in the configuration file using the plugin() method:

Setting the default translatable locales

To set up the locales that can be used to translate content, you can pass an array of locales to the defaultLocales() plugin method:

Preparing your model class

You need to make your model translatable. You can read how to do this in Spatie's documentation.

Preparing your resource class

You must apply the Filament\Resources\Concerns\Translatable trait to your resource class:

Making resource pages translatable

After preparing your resource class, you must make each of your resource's pages translatable too. You can find your resource's pages in the Pages directory of each resource folder. To prepare a page, you must apply the corresponding Translatable trait to it, and install a LocaleSwitcher header action:

And if you have a ViewRecord page for your resource:

If you're using a simple resource, you can make the ManageRecords page translatable instead:

Setting the translatable locales for a particular resource

By default, the translatable locales can be set globally for all resources in the plugin configuration. Alternatively, you can customize the translatable locales for a particular resource by overriding the getTranslatableLocales() method in your resource class:

Translating relation managers

First, you must apply the Filament\Resources\RelationManagers\Concerns\Translatable trait to the relation manager class:

Now, you can add a new LocaleSwitcher action to the header of the relation manager's table():

Inheriting the relation manager's active locale from the resource page

If you wish to reactively inherit the locale of the Translatable resource page that the relation manager is being displayed on, you can override the $activeLocale property and add Livewire's Reactive attribute to it:

If you do this, you no longer need a LocaleSwitcher action in the table().

Setting the translatable locales for a particular relation manager

By default, the translatable locales can be set globally for all relation managers in the plugin configuration. Alternatively, you can customize the translatable locales for a particular relation manager by overriding the getTranslatableLocales() method in your relation manager class:

Publishing translations

If you wish to translate the package, you may publish the language files using:


All versions of spatie-laravel-translatable-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/support Version self.version
illuminate/support Version ^10.45|^11.0
spatie/laravel-translatable Version ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package filament/spatie-laravel-translatable-plugin contains the following files

Loading the files please wait ....