optimistdigital/nova-lang is a Laravel package for a laravel nova tool..
It currently has 14 GitHub stars and 12.483 downloads on Packagist (latest version 1.3.0).
Install it with composer require optimistdigital/nova-lang.
Discover more Laravel packages by optimistdigital
or browse all Laravel packages to compare alternatives.
Last updated
Laravel Nova package that allows you to set localization of content.

Install the package in a Laravel Nova project via Composer and run migrations:
# Install package
composer require optimistdigital/nova-lang
Publish the nova-lang configuration file and edit it to your preference:
php artisan vendor:publish --provider="OptimistDigital\NovaLang\ToolServiceProvider" --tag="config"
Register the tool with Nova in the tools() method of the NovaServiceProvider:
// in app/Providers/NovaServiceProvider.php
public function tools()
{
return [
// ...
new \OptimistDigital\NovaLang\NovaLang
];
}
// in /config/nova-lang.php
// ...
'locales' => [
'en' => 'English',
'et' => 'Estonian',
],
// OR
'locales' => function () {
return Locale::all()->pluck('name', 'key');
},
After defining locales in /config/nova-lang.php, you can use helper function.
$locales = nova_lang_get_all_locales();
//or you can use it in another package.
'locales' => nova_lang_get_all_locales(),
$fields[] = NovaLangField::make('Locale', 'locale');
If you are using a translation package like nova-locale-field, you can also give locale_parent_id. localeParentId has to be optainable through url query. Make sure you have defined locale_parent_id in your database.
$fields[] = NovaLangField::make('Locale', 'locale', 'locale_parent_id')
//Your resource file, where you have returned $fields array
public static function indexQuery(NovaRequest $request, $query)
{
$localeColumn = 'your_table_name' . 'locale'
$query->where(function ($subQuery) use ($localeColumn) {
$subQuery->where($localeColumn, nova_lang_get_active_locale())
->orWhereNotIn($localeColumn, array_keys(nova_lang_get_all_locales()));
});
return $query;
}
Nova page manager is open-sourced software licensed under the MIT license.