Laravel Translatable Versions Save

[Deprecated] A Laravel package for multilingual models

v5.5

8 years ago
  • Added Laravel 5.2 support
  • Dropped Laravel 5.0 support
  • Added scope whereTranslationLike() #183
  • Fire 'updated' event when saving translations. #190
  • setAttribute() returns the model itself, which is now the default in eloquent. #201

v5.4

8 years ago

Added

  • Added compatibility with custom primary key. #174

v5.3

8 years ago

Changes

  • Added country based fallback #169
  • Added whereTranslation() scope. #168

Country based fallback

It is now possible to use country based locales. For example, you can have the following locales:

  • English: en
  • Spanish: es
  • Mexican Spanish: es-MX
  • Colombian Spanish: es-CO

To configuration for these locales looks like this:

    'locales' => [ 
        'en',
        'es' => [
            'MX',
            'CO',
        ],
    ];

We can also configure the "glue" between the language and country. If for instance we prefer the format es_MX instead of es-MX, the configuration should look like this:

   'locale_separator' => '_',

What applies for the fallback of the locales using the en-MX format?

Let's say our fallback locale is en. Now, when we try to fetch from the database the translation for the locale es-MX but it doesn't exist, we won't get as fallback the translation for en. Translatable will use as a fallback es (the first part of es-MX) and only if nothing is found, the translation for en is returned.

v5.2

8 years ago

Added

  • Option to override default locale #158
  • Default value in translatedIn() scope #148
  • New scope withTranslation() (including tests) to decrease the number of mysql calls made.
  • Added documentation about scopes.

v5.1.2

8 years ago

Fixed

Changed

  • Method isTranslationAttribute() is now public #151

v5.1.1

8 years ago

Fixed

  • Compatibility with Lumen #121
  • Making an attribute on a translatable model hidden does not hide it #133

v5.1

9 years ago

Added

  • Mutator/accessor translations using the format $country->{'name:de'} thanks to @barryvdh
  • Documentation in readme file

v5.0.1

9 years ago
  • Applied PSR-2 code style.

v5.0

9 years ago
  • Laravel 5 ready
  • Added configuration option for returning fallback translations

v4.5

9 years ago

v. 4.5

  • Added scope to list translated attributes in the current locale.
  • Force fire "saved" event when the original model is not saved, but the translation is. #85