4lexvav/laravel-db-translations

Simple database implementation of Laravel Translations

v0.1.2 2021-08-27 14:42 UTC

This package is auto-updated.

Last update: 2024-04-27 20:27:32 UTC


README

This package provides simple database implementation of Laravel' Loader interface used for translations and a few helper methods that can be exploit to use translations stored in your DB.

Installation

require 4lexvav/laravel-db-translations

Run migrations to create db_translations table:

php artisan vendor:publish --provider="Vav\Translation\DBTranslationServiceProvider" --tag=migrations
php artisan migrate

Usage

Populate your db_translations table with records, so that you can use the helper functions below to display translations.

__db('some.key', ['Placeholder' => 'value'])
trans_db('some.key', ['Placeholder' => 'value'])
trans_choice_db('some.key', count($array), ['Placeholder' => 'value'])