PHPackages                             mosaiqo/translatable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. mosaiqo/translatable

ActiveLibrary[Localization &amp; i18n](/categories/localization)

mosaiqo/translatable
====================

A Laravel package for easy implementation of multilingual models in mongo.

0.0.17(10y ago)145MITPHPPHP &gt;=5.4.0

Since Aug 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mosaiqo/translatable)[ Packagist](https://packagist.org/packages/mosaiqo/translatable)[ RSS](/packages/mosaiqo-translatable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (19)Used By (0)

Mosaiqo Translatable
====================

[](#mosaiqo-translatable)

---

[![Latest Stable Version](https://camo.githubusercontent.com/a46f3a14ac834a65ee6255d7fa282244d05c4f881c21da6b6acf3e9b96d1e393/68747470733a2f2f706f7365722e707567782e6f72672f6d6f736169716f2f7472616e736c617461626c652f762f737461626c65)](https://packagist.org/packages/mosaiqo/translatable)[![Total Downloads](https://camo.githubusercontent.com/711492fbb501a2cd8ac3c4ab42dfb7dbae994e75bf138a7ccaf18c5e22e9825a/68747470733a2f2f706f7365722e707567782e6f72672f6d6f736169716f2f7472616e736c617461626c652f646f776e6c6f616473)](https://packagist.org/packages/mosaiqo/translatable)[![Latest Unstable Version](https://camo.githubusercontent.com/8b1b9844db25179e7413aaab2065873d1cd3eb3a304075fa7cbed24876a1e71e/68747470733a2f2f706f7365722e707567782e6f72672f6d6f736169716f2f7472616e736c617461626c652f762f756e737461626c65)](https://packagist.org/packages/mosaiqo/translatable)[![License](https://camo.githubusercontent.com/ed51439492081e8b862d2059dcf3cf4b5febe013c2573ea505e74c0dd17b9eca/68747470733a2f2f706f7365722e707567782e6f72672f6d6f736169716f2f7472616e736c617461626c652f6c6963656e7365)](https://packagist.org/packages/mosaiqo/translatable)

This is a Laravel 5 package to have multi language models. It is prepared to use with MongoDB and Eloquent (it is planed to make it work also with MySQL).

This package was created to easily store the multi language models by `embedsOne` relations. Its a **Plug &amp; Play package**, if you are using [Laravel MondoDB](https://github.com/jenssegers/laravel-mongodb).

Instalation
===========

[](#instalation)

---

Install it via composer
-----------------------

[](#install-it-via-composer)

##### Require it with composer :

[](#require-it-with-composer-)

```
 composer require mosaiqo/translatable
```

or put it in your composer.json file

```
{
...
	'require' : {
		...
		"mosaiqo/translatable": "dev-master"
	}
...

}
```

##### Add this to your `config/app.php`

[](#add-this-to-your-configappphp)

```
 Mosaiqo\Translatable\TranslatableServiceProvider::class,
```

##### Publish the config:

[](#publish-the-config)

You can change the values, if you like.

```
php artisan vendor:publish --provider="Mosaiqo\Translatable\TranslatableServiceProvider" --tag="config"
```

Issues
======

[](#issues)

---

[![Stories in Ready](https://camo.githubusercontent.com/07020470edfe8a60c42cf51bc255a374152052004d74e4900769e66e268011ca/68747470733a2f2f62616467652e776166666c652e696f2f6d6f736169716f2f7472616e736c617461626c652e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/mosaiqo/translatable)

We are still working on this package. It will be nice if you can get us some feedback.

If you find some errors or have an idea feel free to [ open a new issue ](https://github.com/mosaiqo/translatable/issues/new).

Use it
======

[](#use-it)

---

### Models

[](#models)

1. You need to `use` the `Mosaiqo\Translatable\Traits\Translatable` in the models you want to have multi language ability.
2. You also need to create a Translation model. The convention is to use the model's name for that you want to use with translatable and append `Locale` to it (You can override it in the config file).
3. Optional you can specify the model to use for the translation, if not set it will search by default for a model with the current `modelname` and append `Locale` to it.
4. Set the attributes you want to be translatable with `protected $translatableAttributes`.

```
