2017 © Pedro Peláez
 

library translatr

A simple trait to translate data from database through Laravel model

image

adlanarifzr/translatr

A simple trait to translate data from database through Laravel model

  • Monday, January 8, 2018
  • by adlanarifzr
  • Repository
  • 1 Watchers
  • 3 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Table of Contents

Introduction

To display a translated static text might be easy with Laravel, yet to display a translated data from database/model would usually require a little bit of efforts and lines of code. Translatr helps to simplify the translation concept by integrating a simple trait into the Models without having to have extra tables and such., (*1)

Installation

  1. Install the package through composer
composer require adlanarifzr/translatr
  1. Use the Translatr in your Model
use Translatr\Translatr;

class ModelName extends Model
{
    use Translatr;
}

Usage

You can translate any data in your database by adding column name with _locale at the end of the column/attribute name. For example description_en for English and description_my for Malay language., (*2)

echo $model->description;

This command will display the description based on your current locale. To add more language, simply add new column with different locale., (*3)

Support & Thanks

I would be really grateful if you would contribute to support my development in Laravel packages. I can be reached at adlanarifzr@gmail.com., (*4)

License

The MIT License (MIT). Please see License File for more information., (*5)

The Versions

08/01 2018

dev-master

9999999-dev

A simple trait to translate data from database through Laravel model

  Sources   Download

MIT

by Adlan Arif Zakaria

08/01 2018

v0.0.1

0.0.1.0

A simple trait to translate data from database through Laravel model

  Sources   Download

MIT

by Adlan Arif Zakaria