CRUD
CRUD copied to clipboard
Translatable with fallbacks
WHY
BEFORE - What was wrong? What was happening before this PR?
replaces #4262
Applies the solution me and @tabacitu discussed detailed here: https://github.com/Laravel-Backpack/CRUD/issues/4100#issuecomment-1067671985
Thank you @pxpm . I'll take a look as soon as we're done with the MUSTs in the v5 board. Please take a look at the email I just sent for perspective 💪 Let's do this!!!
Is there any way this fix be extended to the show.blade.php as well? It corrects the functionality on edit but you can still only preview/show the default locale.
I like this solution. I think it's much better than what we had before. It's arguable if it's ok to introduce this as a non-breaking change... but I think if we are smart about it, and the interface is clear enough... it's ok. Admins will understand that the default behaviour has changed, and the admin panel no longer translates the entity by default, but that's still available with a click.
To make it 100% clear and intuitive, we need to be super-careful about the interface. That's where I would like us to make quite a few improvements @pxpm . I want us to go from this:

To this:

Note the most important differences:
- put it in an alert, on the same line as the Language dropdown, with soft padding and nicely ordered;
- action is a button, not a link; that makes it more "clickable" and gives it higher visual hierarchy; same color means it's related to the button to the right (language picker);
- the button text should say "Fill inputs from {fallback_language}" not "Load defaults"; that's because that's what it does, it just fills the inputs; by "Load default" people could understand the translation is already saved... which is not true; plus "defaults" is ambiguous;
- the text should also note the current language, so that it's clear what translation we're talking about;
Hi @pxpm i need to be honest, i never use early translate feature.
I try now as you describe the problem, and yes is annoying and strange:
Create english:

Translate french and i deleted "description", but when i came back to edit, still there, in DB is null:

I update to branch "translatable-with-fallbacks" and works as normal:

I create new entry and everything works great!


Look ready for me.
Cheers.
@pxpm please do a last test on this one (it was built 3 months ago). I you're ok with it, MERGE IT!

We should make sure, that when you add the translation to an already existing untranslated project, we assume that the current strings in database make for the default value in default language when the json is not built yet.
Comes from https://github.com/Laravel-Backpack/community-forum/issues/401