laravel-translatable | A Laravel package for multilingual models | Translation library
kandi X-RAY | laravel-translatable Summary
kandi X-RAY | laravel-translatable Summary
[Deprecated] A Laravel package for multilingual models
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Lists all records for this model .
- Add translated attributes to array .
- Get an attribute .
- Get the translation .
- Load locales .
- Set a country
- Register translations .
- Get the service providers .
- Boot the package .
- Register translatable helper .
laravel-translatable Key Features
laravel-translatable Examples and Code Snippets
Community Discussions
Trending Discussions on laravel-translatable
QUESTION
I'm trying to use "babenkoivan/scout-elasticsearch-driver" with "astrotomic/laravel-translatable", but i don't understand how I could index the translated words.
My Model looks like :
...ANSWER
Answered 2021-Feb-25 at 23:50I found a solution with the override of the method
public function toSearchableArray()
with something like:
QUESTION
The problem is that I want a title with 3 languages (English, Italian, German). The user can add 3 titles on a form for each language which only the Italian is required
. After that the titles are saved in db like this using spatie / laravel-translatable
:
ANSWER
Answered 2020-Dec-11 at 14:28Can you try to $useFallbackLocale=false
param for not getting default locale string.
You can check method usage from source code.
As: $product->getTranslation('description_locale', 'de', false)
QUESTION
I am using https://github.com/Astrotomic/laravel-translatable to make my models translatable.
While I am trying to update the model using below method to update the mode along with its associated translated content.
...ANSWER
Answered 2020-Oct-04 at 12:09I figured out that The issue was in the setup of the productTranslation model.
the 'product_translations' table primary key is a composite of 'product_uuid' and the 'locale'.
so in the 'ProductTranslation' model I defined the primary key as an array
QUESTION
I have a Spring-boot
application that uses JPA
and Hibernate
. You can find the whole code on this GitHub repository.
My question is how can I add internationalization functionality to a specific column without any foreign keys and by using JSON
structure?
For example I would like to define a JPA entity like this:
...ANSWER
Answered 2020-Jun-23 at 10:09Hibernate Types projectSince this is a very common requirement, this answer is based on this article I wrote on my blog, which explains how the Hibernate Types project adds support for mapping
Map
entity attributes as JSON column types.
First, you need to add the Hibernate Type project dependency.
Afterward, you could use either an HStore column or a JSONB column to store the locate-specific titles:
QUESTION
Here's the story, I'm using this package (laravel-translatable) for model Translations.
I used it for the governorates in select box and every thing is good and works, BUT
when I open the debugger I found there is 21 queries run!!
There is 1+N issue, How can I executing to one query!
just for info:
There is two models for translate ( Governorate, GovernorateTranslation ) first one contains just (id)
and the second contains ( id , local , name, governorate_id).
ANSWER
Answered 2020-Jun-26 at 19:08you can try to call all ids in just one query
Some ways to do this
QUESTION
I've been struggling with this issue for a while. I'm upgrading from Laravel 6 to 7, and composer is not cooperating here. It outputs an enormous dependency story which doesn't make any sense to me at all.
I made sure my dependencies support Laravel 7.0, and I might've missed something, but composer is surely not highlighting it if I did.
I removed composer.lock
and vendor
as well.
Here's my composer.json
:
ANSWER
Answered 2020-May-10 at 13:02At the end of the conclusion list, it tells you it wants to install php-tmdb/api: 2.1.x-dev
.
If you go to that project's repo, you'll notice there's a v3 available.
v2 of php-tmdb/api
wants "symfony/event-dispatcher": ">=2.4,<5"
- that collides with laravel's constraint.
Solution: require php-tmdb/api: 3.0
QUESTION
I have a model Publisher
that has a many to many relationship to Collection
Both have a property called approved
that is set to false when initially created
I have a global scope that hides any Publisher
or Collection
where approved === false
ANSWER
Answered 2020-Apr-25 at 22:08After careful investigation and some help, it came to light this was the result of the koenhoeijmakers/laravel-translatable
package on the Collection
I have solved the issue by not applying the middleware that applies the ApprovedScope
on the store
routes where this was causing issues.
QUESTION
Hello I have Post model with relation:
...ANSWER
Answered 2019-Dec-29 at 17:06Try Collection's group-by method:
QUESTION
I am having an unusual issue.
I have a multi tenant Laravel app that uses app()->setLocale() for setting the default locale for the tenant
When I get the locale in the view/controller for any tenant or the root app I get a encrypted string like this:
eyJpdiI6ImtMdFI5Q05KSkU0WlJGaG9HUnF4K2c9PSIsInZhbHVlIjoic3ZVXC90SzVRRjBhUkpQdHJmcHNDUlE9PSIsIm1hYyI6IjE3MDQ4MjBiYTg0YzgwMWRmZmZlMTYxN2EwNDkwODE2MGJmZTNmNDJjOTAwYmE0ZGVlOWY0Yjc4YjIyNmEyMTAifQ==
but if I get it from the AppServiceProvider just after I set it I the correct result like:
en_AU
My composer.json:
...ANSWER
Answered 2019-Oct-22 at 01:57Ok So it turns out the issue is with a middleware that I created to save the users language option to a cookie value.
The problem was that if one did not exist I set the language to false and hence the long string.
The Middleware would then grab this value each time the user loaded the page.
QUESTION
I'm trying to translate a string on my blade that is a parameter being sended on a include:
...ANSWER
Answered 2019-Oct-10 at 14:00__()
should work
Make sure to clear views cache when you change them if they don't refresh automatically
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install laravel-translatable
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page