You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.
This should dump Greece, but the entry for the fallback locale got overwritten by Griechenland.
I looked through your code and didn't find a simple solution to this problem, as this behaviour is intended when fetching translations but not when setting them. To distinguish between this two cases I added a third parameter to getTranslation() that is true when a translation should get created (when called from fill()). Then I added && ! $creating to the elseifhere. Of course this doesn't work for setting attributes via translate(), which is why I didn't submit a pull request.
The text was updated successfully, but these errors were encountered:
thanks for mentioning the issue. I don't think a third parameter is needed. The problem here is that getTranslation() will take $this->useTranslationFallback if set first, and secondly $withFallback.
We could solve this issue by making $withFallback default to null, and give it higher priority if set. Something like that:
When setting the
$useTranslationFallback
attribute on a model, creating non-default translations doesn't work out of the box.An example:
This should dump
Greece
, but the entry for the fallback locale got overwritten byGriechenland
.I looked through your code and didn't find a simple solution to this problem, as this behaviour is intended when fetching translations but not when setting them. To distinguish between this two cases I added a third parameter to
getTranslation()
that istrue
when a translation should get created (when called fromfill()
). Then I added&& ! $creating
to theelseif
here. Of course this doesn't work for setting attributes viatranslate()
, which is why I didn't submit a pull request.The text was updated successfully, but these errors were encountered: