Database driven translation for your Laravel application.
coderscantina/laravel-translations is a Laravel package for database driven translation for your laravel application..
It currently has 0 GitHub stars and 6.625 downloads on Packagist (latest version v1.1.0).
Install it with composer require coderscantina/laravel-translations.
Discover more Laravel packages by coderscantina
or browse all Laravel packages to compare alternatives.
Last updated
A powerful, database-driven translation system for Laravel applications. Store, manage, and retrieve translations directly from your database, with full integration with Laravel's built-in translation system.
composer require coderscantina/translations
The package will automatically register its service provider.
Optionally publish the configuration file:
php artisan vendor:publish --provider="CodersCantina\Translations\ServiceProvider" --tag="config"
Create the translations table:
php artisan migrate
# Basic usage
php artisan translations:add welcome.message 'Welcome to our application'
# With language option
php artisan translations:add welcome.message 'Willkommen in unserer Anwendung' --lang=de
# With namespace
php artisan translations:add welcome.message 'Welcome to our application' --namespace=frontend
use CodersCantina\Translations\Translation;
Translation::create([
'key' => 'welcome.message',
'value' => 'Welcome to our application',
'language_iso' => 'en'
]);
Use Laravel's built-in methods for retrieving translations, such as Lang::get(), __ and trans helpers.
// Using the __ helper
echo __('welcome.message'); // 'Welcome to our application'
// With replacements
echo __('welcome.user', ['name' => 'John']); // 'Welcome, John'
// Specifying language
echo __('welcome.message', [], 'de'); // 'Willkommen in unserer Anwendung'
// Using the trans helper
echo trans('welcome.message');
// Using the facade
use Illuminate\Support\Facades\Lang;
echo Lang::get('welcome.message');
We strongly recommend using dot notation to logically group translations:
auth.login.title
auth.login.email
auth.login.password
auth.register.title
errors.validation.required
errors.server.unavailable
Please see CHANGELOG for more information on what has changed recently.
$ composer test