S
S
Stanislav Pochepko2015-12-29 12:32:51
Internationalization and localization
Stanislav Pochepko, 2015-12-29 12:32:51

Which package to use for multilanguage in laravel Eloquent?

Good afternoon. Podskajite package for multilingual content. I found packages that use either a second table for models, or store fields in json. And I just need an additional lang field in the table.
And , accordingly, it chose the necessary model for the current language in
the
system

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D', 2015-12-29
@DJZT

In general, the question is not as simple as it seems.
IMHO, you should not use a third-party package here, it's better to cut it yourself for specific needs.
You say that you just need an additional lang field in the table.
And what about indexes? Is uniqueness required? And if needed?
It's easier to write your own solution:
- Create the necessary lang-{field} indexes
- Override Eloquent methods for automatic substitution ($model->whereLang(config('app.locale')))
- Validators...
A custom solution for multilingualism, I would not began to use, since almost always the structure of the database is unique.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question