CodersCare / gridelements

Be part of the future of TYPO3! Support Gridelements now and unlock exclusive early access to v13! The well-established Gridelements V12 elevates TYPO3 by bringing grid-based layouts to content elements, with powerful features like advanced drag & drop and real references. Supercharge your workflow and make daily tasks easier. Sponsor us here:
https://coders.care/for/crowdfunding/gridelements
GNU General Public License v3.0
5 stars 25 forks source link

[BUGFIX] Fix translations in deletion modals #56

Open YKWeyer opened 1 year ago

YKWeyer commented 1 year ago

When deleting a contentElement in the page module (TYPO3 11.5.32, GridElements 11.1.0), the confirmation modal doesn't respect the language settings of the user. It is also very unspecific, and doesn't explicitly confirm for deletion (and simply asks "Alert: are you sure?")

German English
image image

This seems to be caused by the Header.html templates, which tries to read a non-existing (or empty) property and falls back to TYPO3 JS defaults in english:

<a class="btn btn-default t3js-modal-trigger" href="{item.deleteUrl}"
  data-severity="warning"
  data-title="{item.deleteConfirmText}"
  data-content="{item.deleteConfirmText}"
  data-button-close-text="{item.deleteCancelText}"
  title="{item.deleteTitle}">

:information_source: See the fallback chain in the Modal TypeScript:

const content = $element.data('bs-content') || $element.data('content') || 'Are you sure?';

I couldn't find anywhere, where deleteConfirmText, deleteTitle or deleteCancelText was being set (in both the GridElements extension and in the TYPO3 core), so I assume it was a copy/paste error, or it was an experiment which wasn't implemented until the end.

After fetching the translations from the backend extension, this is how it looks like:

German English
image image

:information_source: the title and the content are twice the same in German, but this is due to the two strings label.confirm.delete_record.title and label.confirm.delete_record.content being identical in that locale.

sypets commented 1 year ago

There is already an issue open for this: https://github.com/CodersCare/gridelements/issues/45

See also my PR https://github.com/CodersCare/gridelements/pull/60