CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

Translatable with fallbacks

Open pxpm opened this issue 3 years ago • 6 comments

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

pxpm avatar Mar 15 '22 16:03 pxpm

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!!!

tabacitu avatar Mar 15 '22 18:03 tabacitu

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.

kronos-collector avatar May 15 '22 14:05 kronos-collector

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: CleanShot 2022-08-03 at 09 40 29

To this:

CleanShot 2022-08-03 at 09 40 47

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;

tabacitu avatar Aug 03 '22 06:08 tabacitu

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:

screenshot-backpack test-2022 09 12-10_44_13

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

screenshot-backpack test-2022 09 12-10_44_51

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

screenshot-backpack test-2022 09 12-10_45_47

I create new entry and everything works great!

screenshot-backpack test-2022 09 12-10_46_50

screenshot-backpack test-2022 09 12-10_48_24

Look ready for me.

Cheers.

jcastroa87 avatar Sep 12 '22 13:09 jcastroa87

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

git-merge-cfkifmdg3ifoi

tabacitu avatar Dec 20 '22 17:12 tabacitu

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

pxpm avatar Feb 14 '23 15:02 pxpm