Giter Site home page Giter Site logo

windstep / laravel-translatable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nevadskiy/laravel-translatable

0.0 1.0 0.0 827 KB

Translate your Eloquent models into different languages

License: MIT License

Shell 0.11% PHP 99.65% Makefile 0.15% Dockerfile 0.09%

laravel-translatable's Introduction

Stand With Ukraine

Laravel Translatable

Tests Code Coverage License Latest Stable Version

The package allows adding translations to your Eloquent models.

๐Ÿฌ Features

  • Translatable attributes behave like regular model attributes.
  • Full support for accessors, mutators and casts (even JSON).
  • Fallback translations.
  • 4 different strategies for storing translations.

๐Ÿ“บ Quick demo

$book = new Book()
$book->translator()->set('title', 'Fifty miles', 'en')
$book->translator()->set('title', "ะŸ'ัั‚ะดะตััั‚ ะฒะตั€ัั‚ะพะฒ", 'uk')
$book->save();

app()->setLocale('en');
echo $book->title; // Fifty miles

app()->setLocale('uk');
echo $book->title; // ะŸ'ัั‚ะดะตััั‚ ะฒะตั€ัั‚ะพะฒ

โœ… Requirements

  • PHP 7.2 or newer
  • Laravel 7.0 or newer
  • Can work with Octane

๐Ÿ”Œ Installation

Install the package via composer:

composer require nevadskiy/laravel-translatable

๐Ÿ“‘ Documentation

Documentation for the package can be found in the Wiki section.

โœจ Laravel Nova

There is a small package for the Laravel Nova that adds support for translatable fields.

๐Ÿ“„ Changelog

Please see CHANGELOG for more information what has changed recently.

โ˜• Contributing

Thank you for considering contributing. Please see CONTRIBUTING for more information.

๐Ÿ“œ License

The MIT License (MIT). Please see LICENSE for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.