Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translatable fields in Form Screens not populating existing values #2923

Open
macit-emre opened this issue Nov 15, 2024 · 5 comments
Open

Translatable fields in Form Screens not populating existing values #2923

macit-emre opened this issue Nov 15, 2024 · 5 comments
Assignees
Labels

Comments

@macit-emre
Copy link

i am using spatie/laravel-translatable with json fields in translation.

afer upgrading from 14.38.0 to 14.43.1,
Tables with TD::make('title.tr', __('Title')) needs to be TD::make('title', __('Title')),
that can be done by find and replace no problem.

But in form screens,
Input::make('paymentGateway.name.'.$locale) is now cannot populate existing tr,en,etc.. translation of the name field. That will be a lot of massive code refactor (because of dynamically adding new languages), and thus cannot be done by design.

@macit-emre
Copy link
Author

this is because of : e13b5d3

@macit-emre
Copy link
Author

Should i use AsMultiSource instead of AsSource?

@macit-emre
Copy link
Author

nope, it has only 1 json field. I Have to override AsSource. Wish me luck if there will not be any class_uses_recursive usage of this class.

@tabuna
Copy link
Member

tabuna commented Nov 18, 2024

If I understand things correctly, after making some changes to improve performance, the fields with cast to json/array stopped working.

This wasn't something we anticipated, but I don't want to break compatibility. My plan is to either roll back the changes or find a way to keep dot notation support for those fields. I'll also make sure to write a test for it.

If you have some time and are up for helping out, I'd really appreciate it!

@macit-emre
Copy link
Author

You did improved the performance for sure. But spatie/translatable are not provided by array. They are being used by ->attribute so
i implemented the old AsSource in my App/Traits directory and used them in my models instead of orchid's, nothing broken for now.

There is nothing to do for now i think. You may only maintain old "AsSource" or give the new one name as "AsSourceFromArray" or sth.

i dont see any other option here.

I appreciate to help, but no need i think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants