coderscantina/laravel-translations

Database driven translation for your Laravel application.

v1.0.3 2024-02-08 20:41 UTC

This package is auto-updated.

Last update: 2024-04-08 21:01:07 UTC


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