From 216bcdba4256d1c2aeb065502595815577766896 Mon Sep 17 00:00:00 2001 From: Ingolf Steinardt Date: Mon, 5 Aug 2024 18:59:17 +0200 Subject: [PATCH] Fix translations for buttons --- .../View/Contao2BackendView/ButtonRenderer.php | 12 ++++++++---- .../contao/templates/dcbe_general_common_list.html5 | 6 +++++- src/Resources/public/css/generalDriver.css | 2 +- src/Resources/public/css/generalDriver.css.map | 2 +- src/Resources/public/sass/_headerButton.scss | 10 ++++++++++ 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/Contao/View/Contao2BackendView/ButtonRenderer.php b/src/Contao/View/Contao2BackendView/ButtonRenderer.php index 00d5484f6..cb0532ed4 100644 --- a/src/Contao/View/Contao2BackendView/ButtonRenderer.php +++ b/src/Contao/View/Contao2BackendView/ButtonRenderer.php @@ -365,10 +365,10 @@ private function buildCommand( ->setCommand($command) ->setObjModel($model) ->setAttributes($attributes) - ->setLabel($this->getCommandLabel($command)) + ->setLabel($this->getCommandLabel($command, $definitionName, ['%id%' => $model->getId()])) ->setTitle( $this->translateButtonDescription( - str_replace(['.description', '.1'], '', $command->getDescription()), + \preg_replace('#(\.description|\.1)$#', '', $command->getDescription()), $definitionName, ['%id%' => $model->getId()] ) @@ -775,12 +775,16 @@ private function calculateHref(CommandInterface $command, ModelInterface $model) * * @return string */ - private function getCommandLabel(CommandInterface $command): string + private function getCommandLabel(CommandInterface $command, string $definitionName, array $parameter = []): string { if ('' === $label = $command->getLabel()) { $label = $command->getName(); } - return $this->translate($label); + return $this->translateButtonLabel( + \preg_replace('#(\.label|\.0)$#', '', $label), + $definitionName, + $parameter + ); } } diff --git a/src/Resources/contao/templates/dcbe_general_common_list.html5 b/src/Resources/contao/templates/dcbe_general_common_list.html5 index 202c4b205..41bd04e3a 100644 --- a/src/Resources/contao/templates/dcbe_general_common_list.html5 +++ b/src/Resources/contao/templates/dcbe_general_common_list.html5 @@ -37,11 +37,14 @@ assert($translator instanceof TranslatorInterface); block('parent-header'); ?> - header)) : ?> + header || $this->headerButtons) : ?>
+ headerButtons) : ?>
headerButtons ?>
+ + header) : ?> header as $key => $value) : ?> @@ -50,6 +53,7 @@ assert($translator instanceof TranslatorInterface);
+
endblock(); ?> diff --git a/src/Resources/public/css/generalDriver.css b/src/Resources/public/css/generalDriver.css index 74e3ef635..9cbe25b01 100644 --- a/src/Resources/public/css/generalDriver.css +++ b/src/Resources/public/css/generalDriver.css @@ -1,2 +1,2 @@ -@charset "UTF-8";@media projection,screen{div table.tl_listing{margin-top:0!important;margin-bottom:0!important}.tl_folder_tlist{border-top:0}.treepicker_popup a.folding{float:left;margin-right:20px}.tl_listing tr.tl_folder_clipped>td{background-color:#fff9e6}.cursor_disabled{cursor:not-allowed}#dcg_clipboard{position:relative;padding-top:2px;padding-left:40px;min-height:32px;background-image:url(../images/clipboard.svg);background-size:24px 24px;background-position:6px 3px;background-repeat:no-repeat}#dcg_clipboard .btn-clear{position:absolute;top:3px;left:6px;opacity:0;-webkit-transition:opacity 300ms;transition:opacity 300ms}#dcg_clipboard .btn-clear:hover{opacity:1;-webkit-transition:opacity 300ms;transition:opacity 300ms}#dcg_clipboard ul{display:block}#dcg_clipboard li{display:inline-block;border:1px solid #ddd;background-color:#f9f9f9;padding:2px 4px}#dcg_clipboard li>*{display:inline-block;vertical-align:middle}#dcg_clipboard img{vertical-align:middle}.tl_language_panel{padding:6px 6px 7px 0;background:#f3f3f3;border-top:1px solid #fff;border-bottom:1px solid #bbb;text-align:right}.tl_language_panel .tl_select{width:240px}.mac .tl_language_panel select{max-width:none}.mac .tl_language_panel .tl_select,.mac .tl_panel_bottom .tl_select{font-size:11px}.ie .tl_language_panel,.safari .tl_language_panel{overflow:hidden}.tl_language_panel .tl_formbody{position:relative}.ie .tl_language_panel .tl_formbody,.safari .tl_language_panel .tl_formbody{float:right}.tl_language_panel .tl_submit{margin-top:3px;vertical-align:top}.ie .tl_language_panel .tl_submit,.webkit .tl_language_panel .tl_submit{padding-top:4px;padding-bottom:4px}.opera .tl_language_panel .tl_submit{padding-top:3px;padding-bottom:3px;margin-top:-1px}.tl_language_panel img{position:relative;top:4px;vertical-align:top}#general_messageBox{width:-webkit-min-content;width:-moz-min-content;width:min-content;max-width:60%;min-width:40%;padding:24px;position:absolute;left:0;right:0;margin:0 auto;background:#fff no-repeat right center;border:2px solid #666;border-radius:6px;font-family:"Trebuchet MS",Verdana,sans-serif;font-size:15px;text-align:left;word-wrap:break-word}#general_messageBox.loading{background-image:url(../images/loading.gif);padding-right:60px}#general_messageBox.box-small{width:-webkit-max-content;width:-moz-max-content;width:max-content}#general_messageBox .tl_submit{text-align:center}#general_messageBox .tl_submit_container{text-align:right}#general_messageBox .tl_submit_container [type=submit]{margin-left:4px}.stickySave #general_messageBox .tl_submit_container{text-align:right;position:relative}.stickySave #general_messageBox .tl_submit_container [type=submit]{margin-left:4px}#general_messageOverlay{width:-webkit-max-content;width:-moz-max-content;width:max-content;height:100%;position:absolute;top:0;left:0;background:#fff;opacity:0.5}.header_stop{background-image:url("/system/themes/flexible/icons/stop.svg");background-size:16px}} +@charset "UTF-8";@media projection,screen{div table.tl_listing{margin-top:0!important;margin-bottom:0!important}.tl_folder_tlist{border-top:0}.treepicker_popup a.folding{float:left;margin-right:20px}.tl_listing tr.tl_folder_clipped>td{background-color:#fff9e6}.cursor_disabled{cursor:not-allowed}#dcg_clipboard{position:relative;padding-top:2px;padding-left:40px;min-height:32px;background-image:url(../images/clipboard.svg);background-size:24px 24px;background-position:6px 3px;background-repeat:no-repeat}#dcg_clipboard .btn-clear{position:absolute;top:3px;left:6px;opacity:0;-webkit-transition:opacity 300ms;transition:opacity 300ms}#dcg_clipboard .btn-clear:hover{opacity:1;-webkit-transition:opacity 300ms;transition:opacity 300ms}#dcg_clipboard ul{display:block}#dcg_clipboard li{display:inline-block;border:1px solid #ddd;background-color:#f9f9f9;padding:2px 4px}#dcg_clipboard li>*{display:inline-block;vertical-align:middle}#dcg_clipboard img{vertical-align:middle}.tl_language_panel{padding:6px 6px 7px 0;background:#f3f3f3;border-top:1px solid #fff;border-bottom:1px solid #bbb;text-align:right}.tl_language_panel .tl_select{width:240px}.mac .tl_language_panel select{max-width:none}.mac .tl_language_panel .tl_select,.mac .tl_panel_bottom .tl_select{font-size:11px}.ie .tl_language_panel,.safari .tl_language_panel{overflow:hidden}.tl_language_panel .tl_formbody{position:relative}.ie .tl_language_panel .tl_formbody,.safari .tl_language_panel .tl_formbody{float:right}.tl_language_panel .tl_submit{margin-top:3px;vertical-align:top}.ie .tl_language_panel .tl_submit,.webkit .tl_language_panel .tl_submit{padding-top:4px;padding-bottom:4px}.opera .tl_language_panel .tl_submit{padding-top:3px;padding-bottom:3px;margin-top:-1px}.tl_language_panel img{position:relative;top:4px;vertical-align:top}#general_messageBox{width:-webkit-min-content;width:-moz-min-content;width:min-content;max-width:60%;min-width:40%;padding:24px;position:absolute;left:0;right:0;margin:0 auto;background:#fff no-repeat right center;border:2px solid #666;border-radius:6px;font-family:"Trebuchet MS",Verdana,sans-serif;font-size:15px;text-align:left;word-wrap:break-word}#general_messageBox.loading{background-image:url(../images/loading.gif);padding-right:60px}#general_messageBox.box-small{width:-webkit-max-content;width:-moz-max-content;width:max-content}#general_messageBox .tl_submit{text-align:center}#general_messageBox .tl_submit_container{text-align:right}#general_messageBox .tl_submit_container [type=submit]{margin-left:4px}.stickySave #general_messageBox .tl_submit_container{text-align:right;position:relative}.stickySave #general_messageBox .tl_submit_container [type=submit]{margin-left:4px}#general_messageOverlay{width:-webkit-max-content;width:-moz-max-content;width:max-content;height:100%;position:absolute;top:0;left:0;background:#fff;opacity:0.5}.header_stop{background-image:url("/system/themes/flexible/icons/stop.svg");background-size:16px}.tl_header.hover-div:after{content:" ";clear:right;display:block}} /*# sourceMappingURL=generalDriver.css.map */ \ No newline at end of file diff --git a/src/Resources/public/css/generalDriver.css.map b/src/Resources/public/css/generalDriver.css.map index 404a81146..fb25d00db 100644 --- a/src/Resources/public/css/generalDriver.css.map +++ b/src/Resources/public/css/generalDriver.css.map @@ -1 +1 @@ -{"version":3,"sources":["generalDriver.css","../sass/generalDriver.scss","../sass/_clipboard.scss","../sass/_languagePanel.scss","../sass/_messageBox.scss","../sass/_headerButton.scss"],"names":[],"mappings":"AAAA,gBAAgB,CCUhB,yBACE,qBACE,sBAAA,CACA,yBDCF,CCEA,iBACE,YDAF,CCGA,4BACE,UAAA,CACA,iBDDF,CCIA,oCACE,wBDFF,CCKA,iBACE,kBDHF,CE3BF,eACE,iBAAA,CACA,eAAA,CACA,iBAAA,CACA,eAAA,CACA,6CAAA,CACA,yBAAA,CACA,2BAAA,CACA,2BF6BA,CE3BA,0BACE,iBAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,CACA,gCAAA,CAAA,wBF6BF,CE3BE,gCACE,SAAA,CACA,gCAAA,CAAA,wBF6BJ,CE1BA,kBACE,aF4BF,CE1BA,kBACE,oBAAA,CACA,qBAAA,CACA,wBAAA,CACA,eF4BF,CE1BE,oBACE,oBAAA,CACA,qBF4BJ,CEzBA,mBACE,qBF2BF,CGhEF,mBACE,qBAAA,CACA,kBAAA,CACA,yBAAA,CACA,4BAAA,CACA,gBHkEA,CG/DF,8BACE,WHiEA,CG9DF,+BACE,cHgEA,CG7DF,oEAEE,cH+DA,CG5DF,kDAEE,eH8DA,CG3DF,gCACE,iBH6DA,CG1DF,4EAEE,WH4DA,CGzDF,8BACE,cAAA,CACA,kBH2DA,CGxDF,wEAEE,eAAA,CACA,kBH0DA,CGvDF,qCACE,eAAA,CACA,kBAAA,CACA,eHyDA,CGtDF,uBACE,iBAAA,CACA,OAAA,CACA,kBHwDA,CI/GF,oBACE,yBAAA,CAAA,sBAAA,CAAA,iBAAA,CACA,aAAA,CACA,aAAA,CACA,YAAA,CACA,iBAAA,CACA,MAAA,CACA,OAAA,CACA,aAAA,CACA,sCAAA,CACA,qBAAA,CACA,iBAAA,CACA,6CAAA,CACA,cAAA,CACA,eAAA,CACA,oBJiHA,CI/GA,4BACE,2CAAA,CACA,kBJiHF,CI9GA,8BACE,yBAAA,CAAA,sBAAA,CAAA,iBJgHF,CI7GA,+BACE,iBJ+GF,CI5GA,yCACE,gBJ8GF,CI5GE,uDACE,eJ8GJ,CIxGF,qDACE,gBAAA,CACA,iBJ2GA,CIzGA,mEACE,eJ2GF,CIvGF,wBACE,yBAAA,CAAA,sBAAA,CAAA,iBAAA,CACA,WAAA,CACA,iBAAA,CACA,KAAA,CACA,MAAA,CACA,eAAA,CACA,WJyGA,CKjKF,aACE,8DAAA,CACA,oBLmKA,CACF","file":"generalDriver.css"} \ No newline at end of file +{"version":3,"sources":["generalDriver.css","../sass/generalDriver.scss","../sass/_clipboard.scss","../sass/_languagePanel.scss","../sass/_messageBox.scss","../sass/_headerButton.scss"],"names":[],"mappings":"AAAA,gBAAgB,CCUhB,yBACE,qBACE,sBAAA,CACA,yBDCF,CCEA,iBACE,YDAF,CCGA,4BACE,UAAA,CACA,iBDDF,CCIA,oCACE,wBDFF,CCKA,iBACE,kBDHF,CE3BF,eACE,iBAAA,CACA,eAAA,CACA,iBAAA,CACA,eAAA,CACA,6CAAA,CACA,yBAAA,CACA,2BAAA,CACA,2BF6BA,CE3BA,0BACE,iBAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,CACA,gCAAA,CAAA,wBF6BF,CE3BE,gCACE,SAAA,CACA,gCAAA,CAAA,wBF6BJ,CE1BA,kBACE,aF4BF,CE1BA,kBACE,oBAAA,CACA,qBAAA,CACA,wBAAA,CACA,eF4BF,CE1BE,oBACE,oBAAA,CACA,qBF4BJ,CEzBA,mBACE,qBF2BF,CGhEF,mBACE,qBAAA,CACA,kBAAA,CACA,yBAAA,CACA,4BAAA,CACA,gBHkEA,CG/DF,8BACE,WHiEA,CG9DF,+BACE,cHgEA,CG7DF,oEAEE,cH+DA,CG5DF,kDAEE,eH8DA,CG3DF,gCACE,iBH6DA,CG1DF,4EAEE,WH4DA,CGzDF,8BACE,cAAA,CACA,kBH2DA,CGxDF,wEAEE,eAAA,CACA,kBH0DA,CGvDF,qCACE,eAAA,CACA,kBAAA,CACA,eHyDA,CGtDF,uBACE,iBAAA,CACA,OAAA,CACA,kBHwDA,CI/GF,oBACE,yBAAA,CAAA,sBAAA,CAAA,iBAAA,CACA,aAAA,CACA,aAAA,CACA,YAAA,CACA,iBAAA,CACA,MAAA,CACA,OAAA,CACA,aAAA,CACA,sCAAA,CACA,qBAAA,CACA,iBAAA,CACA,6CAAA,CACA,cAAA,CACA,eAAA,CACA,oBJiHA,CI/GA,4BACE,2CAAA,CACA,kBJiHF,CI9GA,8BACE,yBAAA,CAAA,sBAAA,CAAA,iBJgHF,CI7GA,+BACE,iBJ+GF,CI5GA,yCACE,gBJ8GF,CI5GE,uDACE,eJ8GJ,CIxGF,qDACE,gBAAA,CACA,iBJ2GA,CIzGA,mEACE,eJ2GF,CIvGF,wBACE,yBAAA,CAAA,sBAAA,CAAA,iBAAA,CACA,WAAA,CACA,iBAAA,CACA,KAAA,CACA,MAAA,CACA,eAAA,CACA,WJyGA,CKjKF,aACE,8DAAA,CACA,oBLmKA,CK9JE,2BACE,WAAA,CACA,WAAA,CACA,aLgKJ,CACF","file":"generalDriver.css"} \ No newline at end of file diff --git a/src/Resources/public/sass/_headerButton.scss b/src/Resources/public/sass/_headerButton.scss index 77ccda91d..a909436cb 100644 --- a/src/Resources/public/sass/_headerButton.scss +++ b/src/Resources/public/sass/_headerButton.scss @@ -2,3 +2,13 @@ background-image:url("/system/themes/flexible/icons/stop.svg"); background-size: 16px; } + +.tl_header { + &.hover-div { + &::after { + content: " "; + clear: right; + display: block; + } + } +}