CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

wip: setup crud fields based on update language

Open pxpm opened this issue 5 years ago • 6 comments

Notice that all the strings inside the fields html will get translated.

pxpm avatar Nov 03 '20 11:11 pxpm

A new inspection was created.

scrutinizer-notifier avatar Nov 03 '20 11:11 scrutinizer-notifier

image

pxpm avatar Nov 03 '20 11:11 pxpm

image

pxpm avatar Nov 03 '20 12:11 pxpm

Notice that all the strings inside the fields html will get translated.

That's a good thing, right? 😅 I think it's the expected behaviour.

tabacitu avatar Nov 08 '20 12:11 tabacitu

Notice that all the strings inside the fields html will get translated.

That's a good thing, right? 😅 I think it's the expected behaviour.

I am not sure if the intent is to translate the whole field html (notice that you are not switching admin panel language, you are editing an entry in other language).

  • Some people might want to keep things as is.
  • Some people might want to translate the whole editing page. (like this PR)
  • Some people might want only the related results in the editing language

pxpm avatar Nov 09 '20 11:11 pxpm

Notice that all the strings inside the fields html will get translated.

Reminder Pedro: we talked about this, and now that we think about it it is NOT the expected behaviour 🤣

So maybe we do something like this, inside each select (non-ajax) field?!

    $field['getOptionAttribute'] = $field['getOptionAttribute'] ? call_user_func($field['getOptionAttribute']) :  (function ($option, $attribute) {
        // if model is translatable and config says we should show that,
            return $option->getTranslation($attribute, $lang);
        // else
            return $option->$attribute;
    });

Food for thought...

tabacitu avatar Nov 09 '20 16:11 tabacitu

Closing this as we have other more recent PR's that aim to fix this. #4267

pxpm avatar Sep 12 '22 13:09 pxpm