coderscantina / laravel-translations
Database driven translation for your Laravel application.
Installs: 4 069
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- illuminate/database: ^7.0||^8.0||^9.0||^10.0||^11.0
- illuminate/support: ^7.0||^8.0||^9.0||^10.0||^11.0
Requires (Dev)
- doctrine/dbal: ^3.6
- graham-campbell/testbench: ^6.1
- mockery/mockery: ^1.4
- phpunit/phpunit: ^9.6
README
Database driven translations for your Laravel application
Features
- Store translations in database
- Integrates with Laravel's built-in translation system and helpers
Getting started
- Install this package
Install
Require this package with composer:
$ composer require coderscantina/translations
Migrate the database
To add the translations table execute:
php artisan migrate
Usage
Console command to add translations:
php artisan translations:add foo1 'bar baz' php artisan translations:add foo2 'bar baz {quz}'
We strongly advice to use a dot notation to logically group translations, like:
errors.payments.declined
Use Laravel's built-in methods for retrieving translations, such as Lang::get()
, __
and trans
helpers.
__('foo1'); // bar baz __('foo2', ['quz' => 'qux']); // bar baz qux
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test