diff --git a/src/Contao/Event/Subscriber.php b/src/Contao/Event/Subscriber.php index 3717463f..f36d749e 100644 --- a/src/Contao/Event/Subscriber.php +++ b/src/Contao/Event/Subscriber.php @@ -525,7 +525,7 @@ private static function renderSimpleCheckbox( return; } - $event->setRendered($translator->translate('MSC.' . $map[$value])); + $event->setRendered($translator->translate($map[$value], 'dc-general')); } /** diff --git a/src/Contao/Picker/AbstractAwarePickerProvider.php b/src/Contao/Picker/AbstractAwarePickerProvider.php index a5399b5f..2acb52c6 100644 --- a/src/Contao/Picker/AbstractAwarePickerProvider.php +++ b/src/Contao/Picker/AbstractAwarePickerProvider.php @@ -92,7 +92,7 @@ public function createMenuItem(PickerConfig $config) return $this->menuFactory->createItem( $name, [ - 'label' => $this->translator->trans('TL_LANG.MSC.' . $name, [], 'contao_default'), + 'label' => $this->translator->trans('MSC.' . $name, [], 'contao_default'), 'linkAttributes' => ['class' => $name], 'current' => $this->isCurrent($config), 'uri' => $this->generateUrl($config, true) diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php index e97cbc46..f9f0152f 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -16,7 +16,7 @@ * @author David Molineus * @author Richard Henkenjohann * @author Ingolf Steinhardt - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -76,8 +76,8 @@ use function array_key_exists; use function implode; +use function str_contains; use function str_replace; -use function strpos; use function trigger_error; /** @@ -280,7 +280,7 @@ private function languageSwitcher(EnvironmentInterface $environment) return $template ->set('languages', $controller->getSupportedLanguages(null)) ->set('language', $dataProvider->getCurrentLanguage()) - ->set('submit', $this->translator->trans('MSC.showSelected', [], 'contao_default')) + ->set('submit', $this->translator->trans('change-language', [], 'dc-general')) ->set('REQUEST_TOKEN', $this->tokenManager->getToken($this->tokenName)) ->parse(); } @@ -323,11 +323,12 @@ protected function translate($key, $domain, array $parameters = []) $translated = $this->translator->trans($key, $parameters, $domain); // Fallback translate for non symfony domain. - if ($translated === $key) { + if (null !== $domain && $translated === $key && !str_starts_with($domain, 'contao_')) { // @codingStandardsIgnoreStart @trigger_error( - 'Fallback translation for contao lang in the global array. ' . - 'This will remove in the future, use the symfony domain translation.', + 'Fallback translation for contao lang in the global array for key "' . $key . + '" in domain "' . $domain . '". ' . + 'This will get removed in the future, use the symfony domain translation.', E_USER_DEPRECATED ); // @codingStandardsIgnoreEnd @@ -402,7 +403,7 @@ protected function renderTemplate(ContaoBackendViewTemplate $template, Environme $showColumn = $this->getViewSection($definition)->getListingConfig()->getShowColumns(); $template - ->set('subHeadline', $this->translate('MSC.select_models', 'contao_default')) + ->set('subHeadline', $this->translator->trans('select_models', [], 'dc-general')) ->set('tableName', ($definition->getName() ?: 'none')) ->set('select', 'select' === $provider->getParameter('act')) ->set('action', StringUtil::ampersand(Environment::get('request'))) @@ -419,7 +420,7 @@ protected function renderTemplate(ContaoBackendViewTemplate $template, Environme if ( (null !== $template->get('action')) - && (false !== strpos($template->get('action'), 'select=models')) + && (str_contains($template->get('action'), 'select=models')) ) { $template->set('action', str_replace('select=models', 'select=properties', $template->get('action'))); } diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/EditAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/EditAllHandler.php index bad69dbf..30844dd1 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/EditAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/EditAllHandler.php @@ -107,8 +107,8 @@ private function process(Action $action, EnvironmentInterface $environment): str $action, [ 'subHeadline' => - $translator->translate('MSC.' . $inputProvider->getParameter('mode') . 'Selected') . ': ' . - $translator->translate('MSC.all.0'), + $translator->translate($inputProvider->getParameter('mode') . 'Selected', 'dc-general') . ': ' . + $translator->translate('all_label', 'dc-general'), 'fieldsets' => $renderInformation->offsetGet('fieldsets'), 'table' => $definition->getName(), 'error' => $renderInformation->offsetGet('error'), @@ -289,7 +289,7 @@ private function renderEditFields( $fields[] = \sprintf( '

 

%s

 

', - $translator->translate('MSC.no_properties_available') + $translator->translate('no_properties_available', 'dc-general') ); } diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php index ac676e98..86edb89f 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -14,7 +14,7 @@ * @author Sven Baumann * @author Richard Henkenjohann * @author Ingolf Steinhardt - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0 * @filesource */ @@ -131,8 +131,8 @@ private function process(Action $action, EnvironmentInterface $environment) $action, [ 'subHeadline' => - $translator->translate('MSC.' . $inputProvider->getParameter('mode') . 'Selected') . ': ' . - $translator->translate('MSC.all.0'), + $translator->translate($inputProvider->getParameter('mode') . 'Selected', 'dc-general') . ': ' . + $translator->translate('all_label', 'dc-general'), 'fieldsets' => $renderInformation->offsetGet('fieldsets'), 'table' => $definition->getName(), 'error' => $renderInformation->offsetGet('error'), @@ -332,7 +332,7 @@ private function renderFieldSets( if (empty($fieldSet['palette'])) { $fieldSet['palette'] = \sprintf( '

 

%s

 

', - $translator->translate('MSC.no_properties_available') + $translator->translate('no_properties_available', 'dc-general') ); } diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/SelectPropertyAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/SelectPropertyAllHandler.php index 6d10da9c..81c5a7c7 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/SelectPropertyAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/SelectPropertyAllHandler.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,7 @@ * @package contao-community-alliance/dc-general * @author Sven Baumann * @author Ingolf Steinhardt - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0 * @filesource */ @@ -234,10 +234,16 @@ private function isPropertyAllowed(PropertyInterface $property, EnvironmentInter assert($inputProvider instanceof InputProviderInterface); Message::addInfo( - \sprintf( - $translator->translate('MSC.not_allowed_property_info'), - $property->getLabel() ?: $property->getName(), - $translator->translate('MSC.' . $inputProvider->getParameter('mode') . 'Selected') + $translator->translate( + 'not_allowed_property_info', + 'dc-general', + [ + '%property%' => $property->getLabel() ?: $property->getName(), + '%mode%' => $translator->translate( + $inputProvider->getParameter('mode') . 'Selected', + 'dc-general' + ) + ] ) ); @@ -380,8 +386,6 @@ protected function renderTemplate(ContaoBackendViewTemplate $template, Environme $dataDefinition = $environment->getDataDefinition(); assert($dataDefinition instanceof ContainerInterface); - $languageDomain = 'contao_' . $dataDefinition->getName(); - $this->getViewSection($dataDefinition)->getListingConfig()->setShowColumns(false); parent::renderTemplate($template, $environment); @@ -391,8 +395,8 @@ protected function renderTemplate(ContaoBackendViewTemplate $template, Environme 'subHeadline', \sprintf( '%s: %s', - $this->translate('MSC.' . $inputProvider->getParameter('mode') . 'Selected', $languageDomain), - $this->translate('MSC.edit_all_select_properties', $languageDomain) + $this->translate($inputProvider->getParameter('mode') . 'Selected', 'dc-general'), + $this->translate('edit_all_select_properties', 'dc-general') ) ) ->set('mode', 'none') @@ -427,8 +431,6 @@ protected function getSelectButtons(EnvironmentInterface $environment) $definition = $environment->getDataDefinition(); assert($definition instanceof ContainerInterface); - $languageDomain = 'contao_' . $definition->getName(); - $confirmMessage = \htmlentities( \sprintf( '

%s

' . @@ -436,9 +438,9 @@ protected function getSelectButtons(EnvironmentInterface $environment) '
' . '' . '
', - StringUtil::specialchars($this->translate('MSC.nothingSelect', $languageDomain)), + StringUtil::specialchars($this->translate('nothingSelect', 'dc-general')), 'tl_submit', - StringUtil::specialchars($this->translate('MSC.close', $languageDomain)), + StringUtil::specialchars($this->translate('close', 'dc-general')), 'BackendGeneral.hideMessage(); return false;' ) ); @@ -457,7 +459,7 @@ protected function getSelectButtons(EnvironmentInterface $environment) $continueName, $continueName, 'c', - StringUtil::specialchars($this->translate('MSC.continue', $languageDomain)), + StringUtil::specialchars($this->translate('continue', 'dc-general')), $onClick ) ]; diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/ParentedListViewShowAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/ParentedListViewShowAllHandler.php index 5a7f00b7..67176cc3 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/ParentedListViewShowAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/ParentedListViewShowAllHandler.php @@ -233,7 +233,7 @@ function ($value) { private function translateHeaderColumnName($field, $parentName) { return ('tstamp' === $field) - ? $this->translate('MSC.tstamp', 'contao_default') + ? $this->translate('tstamp', 'dc-general') : $this->translate(\sprintf('%s.0', $field), $parentName); } @@ -294,8 +294,8 @@ private function renderForCheckbox(PropertyInterface $property, $value, &$isRend $isRendered = true; return !empty($value) - ? $this->translate('MSC.yes', 'contao_default') - : $this->translate('MSC.no', 'contao_default'); + ? $this->translate('yes', 'dc-general') + : $this->translate('no', 'dc-general'); } /** diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php index 79635779..8452c77f 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php @@ -502,8 +502,8 @@ private function handleGlobalCommands(EnvironmentInterface $environment) $closeCommand ->setName('close_all_button') - ->setLabel('MSC.closeAll.0') - ->setDescription('MSC.closeAll.1') + ->setLabel('closeAll_label') + ->setDescription('closeAll_description') ->setParameters(new ArrayObject()) ->setExtra(new ArrayObject($closeExtra)) ->setDisabled(false); diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php index 0eabb619..2349ae48 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -16,7 +16,7 @@ * @author Sven Baumann * @author David Molineus * @author Ingolf Steinhardt - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -208,9 +208,9 @@ protected function getPropertyLabel(EnvironmentInterface $environment, PropertyI return $label; } - $mscKey = 'MSC.' . $property->getName() . '.0'; - $label = $translator->translate($mscKey); - if ($label !== $mscKey) { + $translationKey = $property->getName() . '_label'; + $label = $translator->translate($translationKey, 'dc-general'); + if ($label !== $translationKey) { return $label; } @@ -292,19 +292,19 @@ protected function convertModel(ModelInterface $model, EnvironmentInterface $env protected function getHeadline(TranslatorInterface $translator, $model) { $headline = $translator->translate( - 'MSC.showRecord', + 'showRecord', $model->getProviderName(), - ['ID ' . $model->getId()] + ['%id%' => 'ID ' . $model->getId()] ); - if ('MSC.showRecord' !== $headline) { + if ('showRecord' !== $headline) { return $headline; } return $translator->translate( - 'MSC.showRecord', - null, - ['ID ' . $model->getId()] + 'showRecord', + 'dc-general', + ['%id%' => 'ID ' . $model->getId()] ); } @@ -354,8 +354,8 @@ protected function process(Action $action, EnvironmentInterface $environment) $template ->set('languages', $controller->getSupportedLanguages($model->getId())) ->set('currentLanguage', $dataProvider->getCurrentLanguage()) - ->set('languageSubmit', $translator->translate('MSC.showSelected')) - ->set('backBT', StringUtil::specialchars($translator->translate('MSC.backBT'))) + ->set('languageSubmit', $translator->translate('change-language', 'dc-general')) + ->set('backBT', StringUtil::specialchars($translator->translate('backBT', 'dc-general'))) ->set('REQUEST_TOKEN', $this->tokenManager->getToken($this->tokenName)); } else { $template->set('languages', null); diff --git a/src/Contao/View/Contao2BackendView/ButtonRenderer.php b/src/Contao/View/Contao2BackendView/ButtonRenderer.php index a3650ff2..6fe8490d 100644 --- a/src/Contao/View/Contao2BackendView/ButtonRenderer.php +++ b/src/Contao/View/Contao2BackendView/ButtonRenderer.php @@ -69,49 +69,49 @@ class ButtonRenderer * * @var list */ - private $circularModelIds; + private array $circularModelIds; /** * The clipboard items in use. * * @var list */ - private $clipboardItems; + private array $clipboardItems; /** * The models for the clipboard items. * * @var CollectionInterface */ - private $clipboardModels; + private CollectionInterface $clipboardModels; /** * The clipboard in use. * * @var CommandCollectionInterface */ - private $commands; + private CommandCollectionInterface $commands; /** * The environment. * * @var EnvironmentInterface */ - private $environment; + private EnvironmentInterface $environment; /** * The event dispatcher. * * @var EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; /** * The translator in use. * * @var TranslatorInterface */ - private $translator; + private TranslatorInterface $translator; /** * Create a new instance. @@ -368,9 +368,9 @@ private function buildCommand($command, $model, $previous, $next, $isCircularRef \sprintf( 'title="%s" class="%s"', StringUtil::specialchars($this->translator->translate( - 'MSC.dc_general_disabled', - 'contao_default', - [$buttonEvent->getTitle()] + 'dc_general_disabled', + 'dc-general', + ['%title%' => $buttonEvent->getTitle()] )), 'cursor_disabled' ) @@ -590,7 +590,7 @@ protected function translate($path) return $value; } - return $this->translator->translate($path); + return $this->translator->translate($path, 'dc-general'); } /** diff --git a/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php b/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php index 12d3669c..38d8e003 100644 --- a/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php +++ b/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php @@ -342,8 +342,8 @@ protected function buildDatePicker($objWidget) positionOffset:{x:-197,y:-182}' . $time . ', pickerClass:"datepicker_bootstrap", useFadeInOut:!Browser.ie, - startDay:' . $translator->translate('MSC.weekOffset', 'contao_default') . ', - titleFormat:"' . $translator->translate('MSC.titleFormat', 'contao_default') . '" + startDay:' . $translator->translate('weekOffset', 'dc-general') . ', + titleFormat:"' . $translator->translate('titleFormat', 'dc-general') . '" });'; } diff --git a/src/Contao/View/Contao2BackendView/EditMask.php b/src/Contao/View/Contao2BackendView/EditMask.php index f409436c..5e2b3287 100644 --- a/src/Contao/View/Contao2BackendView/EditMask.php +++ b/src/Contao/View/Contao2BackendView/EditMask.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -18,7 +18,7 @@ * @author Stefan Heimes * @author Sven Baumann * @author Richard Henkenjohann - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -363,8 +363,8 @@ protected function handlePostPersist() * Get the label for a button from the translator. * * The fallback is as follows: - * 1. Try to translate the button via the data definition name as translation section. - * 2. Try to translate the button name with the prefix 'MSC.'. + * 1. Try to translate the button via the data definition name as translation domain. + * 2. Try to translate the button name with 'dc-general' as translation domain. * 3. Return the input value as nothing worked out. * * @param string $buttonLabel The non translated label for the button. @@ -380,7 +380,7 @@ protected function getButtonLabel($buttonLabel) return $label; } - if (($label = $translator->translate('MSC.' . $buttonLabel)) !== $buttonLabel) { + if (($label = $translator->translate($buttonLabel, 'dc-general')) !== $buttonLabel) { return $label; } @@ -884,7 +884,7 @@ protected function allValuesUnique() if (!$dataProvider->isUniqueValue($propertyName, $value, $this->model->getId())) { $editInformation->setModelError( $this->model, - [$translator->translate('MSC.not_unique', null, [$propertyName])], + [$translator->translate('not_unique', 'dc-general', ['%property%' => $propertyName])], $definition ); @@ -1039,7 +1039,7 @@ private function executeMultiLanguage(ContaoBackendViewTemplate $template) $template ->set('languages', $controller->getSupportedLanguages($this->model->getId())) ->set('language', $dataProvider->getCurrentLanguage()) - ->set('languageSubmit', $translator->translate('MSC.showSelected')) + ->set('languageSubmit', $translator->translate('change-language', 'dc-general')) ->set('languageHeadline', $languages[$dataProvider->getCurrentLanguage()] ?? ''); return; diff --git a/src/Contao/View/Contao2BackendView/EventListener/ColorPickerWizardListener.php b/src/Contao/View/Contao2BackendView/EventListener/ColorPickerWizardListener.php index d075341a..b67b598d 100644 --- a/src/Contao/View/Contao2BackendView/EventListener/ColorPickerWizardListener.php +++ b/src/Contao/View/Contao2BackendView/EventListener/ColorPickerWizardListener.php @@ -95,7 +95,7 @@ public static function getWizard($propInfo, EnvironmentInterface $environment) assert($translator instanceof TranslatorInterface); if (\array_key_exists('colorpicker', $propExtra) && $propExtra['colorpicker']) { - $pickerText = $translator->translate('MSC.colorpicker'); + $pickerText = $translator->translate('colorpicker', 'dc-general'); $event = new GenerateHtmlEvent( 'pickcolor.svg', $pickerText, diff --git a/src/Contao/View/Contao2BackendView/EventListener/CreateSubHeadlineListener.php b/src/Contao/View/Contao2BackendView/EventListener/CreateSubHeadlineListener.php index 6665c7d1..94b96f96 100644 --- a/src/Contao/View/Contao2BackendView/EventListener/CreateSubHeadlineListener.php +++ b/src/Contao/View/Contao2BackendView/EventListener/CreateSubHeadlineListener.php @@ -65,12 +65,12 @@ private function createSubHeadline(string $status, GetEditMaskSubHeadlineEvent $ $translator = $environment->getTranslator(); assert($translator instanceof TranslatorInterface); - $headline = $translator->translate($status, $definitionName, [$event->getModel()->getId()]); + $headline = $translator->translate($status, $definitionName, ['%id%' => $event->getModel()->getId()]); if ($status !== $headline) { $subHeadline = $headline; } else { - $subHeadline = $translator->translate('MSC.' . $status, null, [$event->getModel()->getId()]); + $subHeadline = $translator->translate($status, 'dc-general', ['%id%' => $event->getModel()->getId()]); } $event->setHeadline($subHeadline); diff --git a/src/Contao/View/Contao2BackendView/EventListener/SelectModeButtonsListener.php b/src/Contao/View/Contao2BackendView/EventListener/SelectModeButtonsListener.php index f143c04c..838a5cbe 100644 --- a/src/Contao/View/Contao2BackendView/EventListener/SelectModeButtonsListener.php +++ b/src/Contao/View/Contao2BackendView/EventListener/SelectModeButtonsListener.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -12,7 +12,8 @@ * * @package contao-community-alliance/dc-general * @author Sven Baumann - * @copyright 2013-2023 Contao Community Alliance. + * @author Ingolf Steinhardt + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -57,9 +58,9 @@ public function handleEvent(GetSelectModeButtonsEvent $event) '
' . '' . '
', - StringUtil::specialchars($translator->translate('MSC.nothingSelect', 'contao_default')), + StringUtil::specialchars($translator->translate('nothingSelect', 'dc-general')), 'tl_submit', - StringUtil::specialchars($translator->translate('MSC.close', 'contao_default')), + StringUtil::specialchars($translator->translate('close', 'dc-general')), 'this.blur(); BackendGeneral.hideMessage(); return false;' ) ); @@ -73,9 +74,9 @@ public function handleEvent(GetSelectModeButtonsEvent $event) 'BackendGeneral.confirmSelectDeleteAll(this, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\'); return false;', 'models[]', $confirmMessage, - StringUtil::specialchars($translator->translate('MSC.delAllConfirm', 'contao_default')), - StringUtil::specialchars($translator->translate('MSC.confirmOk', 'contao_default')), - StringUtil::specialchars($translator->translate('MSC.confirmAbort', 'contao_default')) + StringUtil::specialchars($translator->translate('delAllConfirm', 'dc-general')), + StringUtil::specialchars($translator->translate('confirmOk', 'dc-general')), + StringUtil::specialchars($translator->translate('confirmAbort', 'dc-general')) ); $buttons['delete'] = \sprintf( @@ -83,7 +84,7 @@ public function handleEvent(GetSelectModeButtonsEvent $event) 'delete', 'delete', 'd', - StringUtil::specialchars($translator->translate('MSC.deleteSelected', 'contao_default')), + StringUtil::specialchars($translator->translate('deleteSelected', 'dc-general')), $onClickDelete ); } @@ -95,7 +96,7 @@ public function handleEvent(GetSelectModeButtonsEvent $event) 'cut', 'cut', 's', - StringUtil::specialchars($translator->translate('MSC.moveSelected', 'contao_default')), + StringUtil::specialchars($translator->translate('moveSelected', 'dc-general')), $onClick ); } @@ -106,7 +107,7 @@ public function handleEvent(GetSelectModeButtonsEvent $event) 'copy', 'copy', 'c', - StringUtil::specialchars($translator->translate('MSC.copySelected', 'contao_default')), + StringUtil::specialchars($translator->translate('copySelected', 'dc-general')), $onClick ); } @@ -117,7 +118,7 @@ public function handleEvent(GetSelectModeButtonsEvent $event) 'override', 'override', 'v', - StringUtil::specialchars($translator->translate('MSC.overrideSelected', 'contao_default')), + StringUtil::specialchars($translator->translate('overrideSelected', 'dc-general')), $onClick ); @@ -126,7 +127,7 @@ public function handleEvent(GetSelectModeButtonsEvent $event) 'edit', 'edit', 's', - StringUtil::specialchars($translator->translate('MSC.editSelected', 'contao_default')), + StringUtil::specialchars($translator->translate('editSelected', 'dc-general')), $onClick ); } diff --git a/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php b/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php index 129169d6..ce2bb4a6 100644 --- a/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php +++ b/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php @@ -176,7 +176,7 @@ private function renderButton(CommandInterface $command) * * @return string */ - private function translate($path) + private function translate(string $path): string { $definition = $this->environment->getDataDefinition(); assert($definition instanceof ContainerInterface); @@ -186,6 +186,6 @@ private function translate($path) return $value; } - return $this->translator->translate($path); + return $this->translator->translate($path, 'dc-general'); } } diff --git a/src/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php b/src/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php index af9edb7b..1d1d2550 100644 --- a/src/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php +++ b/src/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -17,7 +17,7 @@ * @author Sven Baumann * @author Ingolf Steinhardt * @author Cliff Parnitzky - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -172,9 +172,7 @@ protected function formatGroupHeader( */ private function formatCheckboxOptionLabel($value) { - return ('' !== $value) - ? \ucfirst($this->translator->translate('MSC.yes')) - : \ucfirst($this->translator->translate('MSC.no')); + return \ucfirst($this->translator->translate(('' !== $value) ? 'yes' : 'no', 'dc-general')); } /** @@ -272,7 +270,7 @@ private function formatByWeekGrouping(int $value): string return '-'; } - $event = new ParseDateEvent($value, $this->translator->translate('MSC.week_format')); + $event = new ParseDateEvent($value, $this->translator->translate('week_format', 'dc-general')); $this->dispatcher->dispatch($event, ContaoEvents::DATE_PARSE); return $event->getResult(); diff --git a/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php b/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php index 64f09b90..b997520e 100644 --- a/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php +++ b/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php @@ -342,10 +342,10 @@ protected function getXLabel($propInfo) if (('textarea' === $propInfo->getWidgetType()) && !\array_key_exists('rte', $propInfo->getExtra())) { $event = new GenerateHtmlEvent( 'wrap.svg', - $translator->translate('MSC.wordWrap'), + $translator->translate('wordWrap', 'dc-general'), \sprintf( 'title="%s" class="toggleWrap" onclick="Backend.toggleWrap(\'ctrl_%s\');"', - StringUtil::specialchars($translator->translate('MSC.wordWrap')), + StringUtil::specialchars($translator->translate('wordWrap', 'dc-general')), $propInfo->getName() ) ); @@ -391,7 +391,7 @@ protected function getHelpWizard($propInfo) if ($propInfo->getExtra() && \array_key_exists('helpwizard', $propInfo->getExtra())) { $event = new GenerateHtmlEvent( 'about.svg', - $translator->translate('MSC.helpWizard'), + $translator->translate('helpWizard', 'dc-general'), 'style="vertical-align:text-bottom;"' ); @@ -409,7 +409,7 @@ protected function getHelpWizard($propInfo) 'onclick="Backend.openWindow(this, 600, 500); return false;">%s', $definition->getName(), $propInfo->getName(), - StringUtil::specialchars($translator->translate('MSC.helpWizard')), + StringUtil::specialchars($translator->translate('helpWizard', 'dc-general')), $event->getHtml() ?? '' ); } diff --git a/src/Contao/View/Contao2BackendView/TreePicker.php b/src/Contao/View/Contao2BackendView/TreePicker.php index 22734d38..79b81aed 100644 --- a/src/Contao/View/Contao2BackendView/TreePicker.php +++ b/src/Contao/View/Contao2BackendView/TreePicker.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,7 +19,7 @@ * @author Ingolf Steinhardt * @author David Molineus * @author Kim Wormer - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -78,6 +78,7 @@ * * @property array{fields: list, format: string, maxCharacters: int}|null $itemLabel * @property string $searchField + * @property string foreignTable * * @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.TooManyFields) @@ -154,13 +155,6 @@ class TreePicker extends Widget */ protected $titleIcon = 'system/themes/flexible/icons/pagemounts.svg'; - /** - * The title to display. - * - * @var string - */ - protected $title = ''; - /** * The data container for the item source. * @@ -645,9 +639,12 @@ public function generate() /** @psalm-suppress PropertyNotSetInConstructor */ ->set('class', ($this->strClass ? ' ' . $this->strClass : '')) ->set('icon', $icon->getHtml()) - ->set('title', $translator->translate($this->title ?: 'MSC.treePicker', null, [$this->sourceName])) - ->set('changeSelection', $translator->translate('MSC.changeSelection')) - ->set('dragItemsHint', $translator->translate('MSC.dragItemsHint')) + ->set( + 'title', + $translator->translate('treePicker', 'dc-general', ['%table%' => $this->sourceName]) + ) + ->set('changeSelection', $translator->translate('changeSelection', 'dc-general')) + ->set('dragItemsHint', $translator->translate('dragItemsHint', 'dc-general')) ->set('fieldType', $this->fieldType) ->set('values', $this->renderItemsPlain()) ->set('label', $this->label) @@ -871,8 +868,8 @@ private function addOrderFieldToTemplate(ContaoBackendViewTemplate $template) ->set('orderId', $this->orderField) ->set('orderName', $this->orderName) ->set('orderValue', \implode(',', (array) $this->value)) - ->set('changeSelection', $translator->translate('MSC.changeSelection')) - ->set('dragItemsHint', $translator->translate('MSC.dragItemsHint')); + ->set('changeSelection', $translator->translate('changeSelection', 'dc-general')) + ->set('dragItemsHint', $translator->translate('dragItemsHint', 'dc-general')); } /** @@ -909,10 +906,13 @@ public function generatePopup() /** @psalm-suppress PropertyNotSetInConstructor */ ->set('class', ($this->strClass ? ' ' . $this->strClass : '')) ->set('icon', $icon->getHtml()) - ->set('title', $translator->translate($this->title ?: 'MSC.treePicker', null, [$this->sourceName])) + ->set( + 'title', + $translator->translate('treePicker', 'dc-general', ['%table%' => $this->sourceName]) + ) ->set('fieldType', $this->fieldType) - ->set('resetSelected', $translator->translate('MSC.resetSelected')) - ->set('selectAll', $translator->translate('MSC.selectAll')) + ->set('resetSelected', $translator->translate('.resetSelected', 'dc-general')) + ->set('selectAll', $translator->translate('selectAll', 'dc-general')) ->set('values', StringUtil::deserialize($this->varValue, true)); // Create Tree Render with custom root points. @@ -1500,9 +1500,9 @@ protected function parseModel($model, $toggleID) assert($translator instanceof TranslatorInterface); if ($model->getMeta($model::SHOW_CHILDREN)) { - $toggleTitle = $translator->translate('MSC.collapseNode'); + $toggleTitle = $translator->translate('collapseNode', 'dc-general'); } else { - $toggleTitle = $translator->translate('MSC.expandNode'); + $toggleTitle = $translator->translate('expandNode', 'dc-general'); } $toggleScript = \sprintf( diff --git a/src/Contao/View/Contao2BackendView/TreeView.php b/src/Contao/View/Contao2BackendView/TreeView.php index 5895b4fe..6a839cb0 100644 --- a/src/Contao/View/Contao2BackendView/TreeView.php +++ b/src/Contao/View/Contao2BackendView/TreeView.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2023 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -17,7 +17,7 @@ * @author David Molineus * @author Ingolf Steinhardt * @author Sven Baumann - * @copyright 2013-2023 Contao Community Alliance. + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -385,9 +385,9 @@ protected function parseModel($model, $toggleID) assert($translator instanceof TranslatorInterface); if ($model->getMeta($model::SHOW_CHILDREN)) { - $toggleTitle = $translator->translate('MSC.collapseNode'); + $toggleTitle = $translator->translate('collapseNode', 'dc-general'); } else { - $toggleTitle = $translator->translate('MSC.expandNode'); + $toggleTitle = $translator->translate('expandNode', 'dc-general'); } $toggleUrlEvent = new AddToUrlEvent( @@ -763,7 +763,7 @@ private function languageSwitcher(EnvironmentInterface $environment) return $template ->set('languages', $controller->getSupportedLanguages(null)) ->set('language', $dataProvider->getCurrentLanguage()) - ->set('submit', $translator->translate('MSC.showSelected')) + ->set('submit', $translator->translate('change-language', 'dc-general')) ->set('REQUEST_TOKEN', $this->tokenManager->getToken($this->tokenName)) ->parse(); } diff --git a/src/Controller/BackendTreeController.php b/src/Controller/BackendTreeController.php index cf7ca7da..4adf03e9 100644 --- a/src/Controller/BackendTreeController.php +++ b/src/Controller/BackendTreeController.php @@ -41,7 +41,8 @@ use ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag; use ContaoCommunityAlliance\DcGeneral\DataDefinition\ContainerInterface; use ContaoCommunityAlliance\DcGeneral\Factory\DcGeneralFactory; -use ContaoCommunityAlliance\Translator\TranslatorInterface; +use ContaoCommunityAlliance\Translator\TranslatorInterface as CcaTranslator; +use InvalidArgumentException; use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; @@ -53,6 +54,12 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Contracts\Translation\TranslatorInterface; + +use function array_filter; +use function define; +use function explode; +use function is_array; /** * Handles the backend tree. @@ -138,6 +145,16 @@ private function initializeAndExtractRequest(): Request return $currentRequest; } + private function getTranslator(): TranslatorInterface + { + $container = $this->container; + assert($container instanceof SymfonyContainerInterface); + $translator = $container->get('translator'); + assert($translator instanceof TranslatorInterface); + + return $translator; + } + /** * Run the controller and parse get the response template. * @@ -145,7 +162,7 @@ private function initializeAndExtractRequest(): Request * * @return Response * - * @throws \InvalidArgumentException No picker was given here. + * @throws InvalidArgumentException No picker was given here. * * @SuppressWarnings(PHPMD.Superglobals) */ @@ -160,13 +177,22 @@ private function runBackendTree(Request $request) ->set('theme', Backend::getTheme()) ->set('base', Environment::get('base')) ->set('language', $GLOBALS['TL_LANGUAGE']) - ->set('title', StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['treepicker'] ?? '')) + ->set( + 'title', + StringUtil::specialchars( + $this->getTranslator()->trans( + 'treepicker', + ['%table%' => $treeSelector->foreignTable], + 'dc-general' + ) + ) + ) ->set('charset', $GLOBALS['TL_CONFIG']['characterSet']) ->set('addSearch', $treeSelector->searchField) - ->set('search', $GLOBALS['TL_LANG']['MSC']['search']) + ->set('search', $this->getTranslator()->trans('search', [], 'dc-general')) ->set('action', StringUtil::ampersand($request->getUri())) ->set('value', $value) - ->set('manager', $GLOBALS['TL_LANG']['MSC']['treepickerManager'] ?? '') + ->set('manager', $this->getTranslator()->trans('treepickerManager', [], 'dc-general')) ->set('breadcrumb', $GLOBALS['TL_DCA'][$treeSelector->foreignTable]['list']['sorting']['breadcrumb'] ?? ''); return $template->getResponse(); @@ -179,7 +205,7 @@ private function runBackendTree(Request $request) * * @return Response * - * @throws \InvalidArgumentException No picker was given here. + * @throws InvalidArgumentException No picker was given here. * * @SuppressWarnings(PHPMD.Superglobals) */ @@ -188,7 +214,7 @@ private function runBackendTreeBreadCrumb(Request $request) [, $treeSelector] = $this->getTemplateData($request); $message = ' - The bread crumb method isn´ implement yet. + The bread crumb method isn\'t implement yet. '; $treeSelector->generatePopup(); @@ -199,11 +225,14 @@ private function runBackendTreeBreadCrumb(Request $request) ->set('theme', Backend::getTheme()) ->set('base', Environment::get('base')) ->set('language', $GLOBALS['TL_LANGUAGE']) - ->set('title', StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['treepicker'])) - ->set('charset', $GLOBALS['TL_CONFIG']['characterSet']) - ->set('search', $GLOBALS['TL_LANG']['MSC']['search']) + ->set( + 'title', + StringUtil::specialchars($this->getTranslator()->trans('treepickerManager', [], 'dc-general')) + ) + ->set('charset', $this->getTranslator()->trans('characterSet', [], 'dc-general')) + ->set('search', $this->getTranslator()->trans('search', [], 'dc-general')) ->set('action', StringUtil::ampersand($request->getUri())) - ->set('manager', $GLOBALS['TL_LANG']['MSC']['treepickerManager']); + ->set('manager', $this->getTranslator()->trans('treepickerManager', [], 'dc-general')); return $template->getResponse(); } @@ -215,7 +244,7 @@ private function runBackendTreeBreadCrumb(Request $request) * * @return Response * - * @throws \InvalidArgumentException No picker was given here. + * @throws InvalidArgumentException No picker was given here. */ private function runBackendTreeToggle(Request $request) { @@ -254,7 +283,7 @@ private function runBackendTreeUpdate(Request $request) $container = $this->container; assert($container instanceof SymfonyContainerInterface); $translator = $container->get('cca.translator.contao_translator'); - assert($translator instanceof TranslatorInterface); + assert($translator instanceof CcaTranslator); $dispatcher = $container->get('event_dispatcher'); assert($dispatcher instanceof EventDispatcherInterface); @@ -273,7 +302,7 @@ private function runBackendTreeUpdate(Request $request) $model = $dataProvider->getEmptyModel(); } - if (\is_array($value)) { + if (is_array($value)) { $values = []; // Clean keys they have empty value. foreach ($value as $index => $val) { @@ -355,7 +384,7 @@ private function getTemplateData(Request $request, bool $valueFromRequest = fals * * @return TreePicker * - * @throws \InvalidArgumentException If invalid characters in the data provider name or property name. + * @throws InvalidArgumentException If invalid characters in the data provider name or property name. * * @SuppressWarnings(PHPMD.Superglobals) */ @@ -364,11 +393,11 @@ private function prepareTreeSelector(PickerInterface $picker) $modelId = ModelId::fromSerialized($picker->getConfig()->getExtra('modelId')); if (Validator::isInsecurePath($table = $modelId->getDataProviderName())) { - throw new \InvalidArgumentException('The table name contains invalid characters'); + throw new InvalidArgumentException('The table name contains invalid characters'); } if (Validator::isInsecurePath($field = $picker->getConfig()->getExtra('propertyName'))) { - throw new \InvalidArgumentException('The field name contains invalid characters'); + throw new InvalidArgumentException('The field name contains invalid characters'); } $container = $this->container; @@ -381,10 +410,10 @@ private function prepareTreeSelector(PickerInterface $picker) assert($sessionBag instanceof AttributeBagInterface); // Define the current ID. - \define('CURRENT_ID', ($table ? $sessionBag->get('CURRENT_ID') : $modelId->getId())); + define('CURRENT_ID', ($table ? $sessionBag->get('CURRENT_ID') : $modelId->getId())); $translator = $container->get('cca.translator.contao_translator'); - assert($translator instanceof TranslatorInterface); + assert($translator instanceof CcaTranslator); $dispatcher = $container->get('event_dispatcher'); assert($dispatcher instanceof EventDispatcherInterface); @@ -417,7 +446,7 @@ private function prepareTreeSelector(PickerInterface $picker) Widget::getAttributesFromDca( $information, $field, - \array_filter(\explode(',', $picker->getConfig()->getValue())), + array_filter(explode(',', $picker->getConfig()->getValue())), $field, $table, $dcCompat diff --git a/src/DataDefinition/Definition/View/BackCommand.php b/src/DataDefinition/Definition/View/BackCommand.php index 86c59982..e64d0468 100644 --- a/src/DataDefinition/Definition/View/BackCommand.php +++ b/src/DataDefinition/Definition/View/BackCommand.php @@ -36,7 +36,7 @@ public function __construct() $this->extra['attributes'] = 'onclick="Backend.getScrollOffset();"'; $this ->setName('back_button') - ->setLabel('MSC.backBT') - ->setDescription('MSC.backBT'); + ->setLabel('backBT') + ->setDescription('backBTTitle'); } } diff --git a/src/Panel/DefaultLimitElement.php b/src/Panel/DefaultLimitElement.php index c518df7f..a5f4b384 100644 --- a/src/Panel/DefaultLimitElement.php +++ b/src/Panel/DefaultLimitElement.php @@ -30,6 +30,7 @@ use ContaoCommunityAlliance\DcGeneral\DataDefinition\ContainerInterface; use ContaoCommunityAlliance\DcGeneral\InputProviderInterface; use ContaoCommunityAlliance\DcGeneral\View\ViewTemplateInterface; +use ContaoCommunityAlliance\Translator\TranslatorInterface; /** * Default implementation of a limit panel element. @@ -244,11 +245,14 @@ private function getAmountForFilterOptionAll(): int */ public function render(ViewTemplateInterface $viewTemplate) { + $translator = $this->getEnvironment()->getTranslator(); + assert($translator instanceof TranslatorInterface); + $options = [ [ 'value' => '0,' . $this->getItemsPerPage(), 'attributes' => '', - 'content' => $GLOBALS['TL_LANG']['MSC']['filterRecords'] + 'content' => $translator->translate('filterRecords', 'dc-general') ] ]; @@ -286,7 +290,7 @@ public function render(ViewTemplateInterface $viewTemplate) ((0 === $this->getOffset()) && ($this->intTotal === $this->getAmount())) ? 'selected' : '', - 'content' => $GLOBALS['TL_LANG']['MSC']['filterAll'] + 'content' => $translator->translate('filterAll', 'dc-general') ]; } diff --git a/src/Resources/contao/languages/de/default.php b/src/Resources/contao/languages/de/default.php deleted file mode 100644 index 97f57809..00000000 --- a/src/Resources/contao/languages/de/default.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @author Stefan Heimes - * @author Tristan Lins - * @author Sven Baumann - * @author Ingolf Steinhardt - * @author David Molineus - * @author Cliff Parnitzky - * @copyright 2013-2023 Contao Community Alliance. - * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later - * @filesource - */ - -// @codingStandardsIgnoreStart -$GLOBALS['TL_LANG']['MSC']['language'] = 'Sprache'; -$GLOBALS['TL_LANG']['MSC']['showSelected'] = 'Sprache wechseln'; -$GLOBALS['TL_LANG']['MSC']['treePicker'] = 'Tabelle: %s'; -$GLOBALS['TL_LANG']['MSC']['not_unique'] = 'Die Eigenschaft "%s" ist schon in der Datenbank und nicht unique.'; -$GLOBALS['TL_LANG']['MSC']['nothingSelect'] = 'Es wurde nichts ausgewählt!'; -$GLOBALS['TL_LANG']['MSC']['confirmOk'] = 'Ok'; -$GLOBALS['TL_LANG']['MSC']['confirmAbort'] = 'Abbrechen'; -$GLOBALS['TL_LANG']['MSC']['closeAll'] = ['Beenden', 'Die Mehrfachbearbeitung beenden.']; -$GLOBALS['TL_LANG']['MSC']['property_select_unique'] = '%s ist eine eindeutige Eigenschaft. Diese Eigenschaft wird bei %s nicht unterstützt.'; -$GLOBALS['TL_LANG']['MSC']['not_allowed_property_info'] = 'Die Eigenschaft "%s" wird im Modus %s nicht untersützt.'; -$GLOBALS['TL_LANG']['MSC']['select_property_info'] = 'Die Eigenschaft "%s" muss ausgewählt sein, damit diese bearbeitet werden kann.'; -$GLOBALS['TL_LANG']['MSC']['select_parent_property_info'] = 'Die Abhängige Eigenschaft "%s" muss ausgewählt sein, damit man die Eigenschaft "%s" bearbeiten kann.'; -$GLOBALS['TL_LANG']['MSC']['edit_all_select_properties'] = 'Eigenschaften auswählen'; -$GLOBALS['TL_LANG']['MSC']['no_properties_available'] = 'Bitte überprüfen Sie die ausgewählten Eigenschaften!'; -$GLOBALS['TL_LANG']['MSC']['select_models'] = 'Elemente auswählen'; -$GLOBALS['TL_LANG']['MSC']['dc_general_disabled'] = 'Gesperrt: %s'; -$GLOBALS['TL_LANG']['MSC']['newRecord'] = 'Neuen Datensatz erstellen'; -$GLOBALS['TL_LANG']['MSC']['week_format'] = 'W. Y'; -// @codingStandardsIgnoreEnd diff --git a/src/Resources/contao/languages/en/default.php b/src/Resources/contao/languages/en/default.php deleted file mode 100644 index defc1134..00000000 --- a/src/Resources/contao/languages/en/default.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @author Stefan Heimes - * @author Tristan Lins - * @author Sven Baumann - * @author Ingolf Steinhardt - * @author David Molineus - * @author Cliff Parnitzky - * @copyright 2013-2023 Contao Community Alliance. - * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later - * @filesource - */ - -// @codingStandardsIgnoreStart -$GLOBALS['TL_LANG']['MSC']['language'] = 'Language'; -$GLOBALS['TL_LANG']['MSC']['showSelected'] = 'Switch language'; -$GLOBALS['TL_LANG']['MSC']['treePicker'] = 'Table: %s'; -$GLOBALS['TL_LANG']['MSC']['not_unique'] = 'The property "%s" is already in the database and not unique.'; -$GLOBALS['TL_LANG']['MSC']['nothingSelect'] = 'Nothing was selected!'; -$GLOBALS['TL_LANG']['MSC']['confirmOk'] = 'Ok'; -$GLOBALS['TL_LANG']['MSC']['confirmAbort'] = 'Abort'; -$GLOBALS['TL_LANG']['MSC']['closeAll'] = ['Cancel', 'Cancel multiple processing.']; -$GLOBALS['TL_LANG']['MSC']['property_select_unique'] = '%s is a unique property. This property is not supported at %s.'; -$GLOBALS['TL_LANG']['MSC']['not_allowed_property_info'] = 'The property "%s" isn´t allow to use at %s.'; -$GLOBALS['TL_LANG']['MSC']['select_property_info'] = 'You must select the property "%s" for edit it.'; -$GLOBALS['TL_LANG']['MSC']['select_parent_property_info'] = 'You must select the parent property "%s" for edit the property "%s".'; -$GLOBALS['TL_LANG']['MSC']['edit_all_select_properties'] = 'Select properties'; -$GLOBALS['TL_LANG']['MSC']['no_properties_available'] = 'Please check your selected properties!'; -$GLOBALS['TL_LANG']['MSC']['select_models'] = 'Select models'; -$GLOBALS['TL_LANG']['MSC']['dc_general_disabled'] = 'Disabled: %s'; -$GLOBALS['TL_LANG']['MSC']['newRecord'] = 'Create a new item'; -$GLOBALS['TL_LANG']['MSC']['week_format'] = 'W Y'; -// @codingStandardsIgnoreEnd diff --git a/src/Resources/contao/templates/dcbe_general_clipboard.html5 b/src/Resources/contao/templates/dcbe_general_clipboard.html5 index 296ae488..63f01dd7 100644 --- a/src/Resources/contao/templates/dcbe_general_clipboard.html5 +++ b/src/Resources/contao/templates/dcbe_general_clipboard.html5 @@ -4,10 +4,13 @@ use Contao\StringUtil; use ContaoCommunityAlliance\Contao\Bindings\ContaoEvents; use ContaoCommunityAlliance\Contao\Bindings\Events\Image\GenerateHtmlEvent; use ContaoCommunityAlliance\DcGeneral\Clipboard\ItemInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** @var \ContaoCommunityAlliance\DcGeneral\EnvironmentInterface $environment */ $environment = $this->environment; $eventDispatcher = $environment->getEventDispatcher(); +$translator = \System::getContainer()->get('translator'); +assert($translator instanceof TranslatorInterface); // pre render the clipboard icon $event = new GenerateHtmlEvent( @@ -60,7 +63,7 @@ if (\count($this->options)): ?> + title="trans(id: 'clearClipboard', domain: 'dc-general')) ?>"> diff --git a/src/Resources/contao/templates/dcbe_general_common_list.html5 b/src/Resources/contao/templates/dcbe_general_common_list.html5 index 2a794731..95a3275e 100644 --- a/src/Resources/contao/templates/dcbe_general_common_list.html5 +++ b/src/Resources/contao/templates/dcbe_general_common_list.html5 @@ -4,14 +4,17 @@ use Contao\StringUtil; use ContaoCommunityAlliance\DcGeneral\Data\ModelId; use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface; use ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\View\GroupAndSortingInformationInterface; +use Symfony\Contracts\Translation\TranslatorInterface; $requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue(); +$translator = \System::getContainer()->get('translator'); +assert($translator instanceof TranslatorInterface); ?> block('messages'); ?> getMessages(); ?> info): ?>
-

', $this->info); ?>

+

', $this->info) ?>

endblock(); ?> @@ -29,7 +32,7 @@ $requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDe

subHeadline ?>languageHeadline != "") ? " - " . $this->languageHeadline : "" ?>

- +
@@ -54,7 +57,7 @@ $requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDe endblock(); ?> block('empty'); ?> collection->length() < 1) : ?> -

+

trans(id: 'noResult', domain: 'dc-general') ?>

endblock(); ?> block('body'); ?> diff --git a/src/Resources/contao/templates/dcbe_general_edit.html5 b/src/Resources/contao/templates/dcbe_general_edit.html5 index 3bb3b6ba..13468767 100644 --- a/src/Resources/contao/templates/dcbe_general_edit.html5 +++ b/src/Resources/contao/templates/dcbe_general_edit.html5 @@ -1,9 +1,11 @@ get('contao.csrf.token_manager')->getDefaultTokenValue(); - +$translator = \System::getContainer()->get('translator'); +assert($translator instanceof TranslatorInterface); // Add CSS $GLOBALS['TL_CSS'][] = 'bundles/ccadcgeneral/css/generalDriver.css'; ?> @@ -16,13 +18,13 @@ $GLOBALS['TL_CSS'][] = 'bundles/ccadcgeneral/css/generalDriver.css'; + diff --git a/src/Resources/contao/templates/dcbe_general_field.html5 b/src/Resources/contao/templates/dcbe_general_field.html5 index cb4cacd0..33c41f15 100644 --- a/src/Resources/contao/templates/dcbe_general_field.html5 +++ b/src/Resources/contao/templates/dcbe_general_field.html5 @@ -1,3 +1,7 @@ +get('translator'); +assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface); +?>
disabled): ?> @@ -15,11 +19,11 @@ blnUpdate): ?> -

+

-
-
- +
+
+
hasErrors) echo $this->strHelp; ?> diff --git a/src/Resources/contao/templates/dcbe_general_language_panel.html5 b/src/Resources/contao/templates/dcbe_general_language_panel.html5 index ad07f1f4..af1667f6 100644 --- a/src/Resources/contao/templates/dcbe_general_language_panel.html5 +++ b/src/Resources/contao/templates/dcbe_general_language_panel.html5 @@ -1,5 +1,9 @@ get('contao.csrf.token_manager')->getDefaultTokenValue(); +$requestToken = \Contao\System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue(); +$translator = \Contao\System::getContainer()->get('translator'); +assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface); + +$apply = $translator->trans(id: 'apply', domain: 'dc-general'); ?>
@@ -8,13 +12,13 @@ $requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDe
- +
- : + trans(id: 'sortBy', domain: 'dc-general') ?>:
diff --git a/src/Resources/contao/templates/dcbe_general_language_selector.html5 b/src/Resources/contao/templates/dcbe_general_language_selector.html5 index 4723ecf8..b8aba655 100644 --- a/src/Resources/contao/templates/dcbe_general_language_selector.html5 +++ b/src/Resources/contao/templates/dcbe_general_language_selector.html5 @@ -7,7 +7,8 @@ use Contao\StringUtil;
- languages as $langCode => $languageName) : ?>
diff --git a/src/Resources/contao/templates/dcbe_general_panel_sort.html5 b/src/Resources/contao/templates/dcbe_general_panel_sort.html5 index 9f9b2687..6206c354 100644 --- a/src/Resources/contao/templates/dcbe_general_panel_sort.html5 +++ b/src/Resources/contao/templates/dcbe_general_panel_sort.html5 @@ -1,5 +1,9 @@ +get('translator'); +assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface); +?>
- : + trans(id: 'sortBy', domain: 'dc-general') ?>:
diff --git a/src/Resources/contao/templates/widget_filetree.html5 b/src/Resources/contao/templates/widget_filetree.html5 index 9912994b..9bdf1c06 100644 --- a/src/Resources/contao/templates/widget_filetree.html5 +++ b/src/Resources/contao/templates/widget_filetree.html5 @@ -8,7 +8,7 @@ $requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDe
hasOrder && \count($this->icons) > 1): ?> -

translate('MSC.dragItemsHint') ?>

+

translate('dragItemsHint', 'dc-general') ?>

    icons as $icon): ?> @@ -19,7 +19,7 @@ $requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDe
readonly): ?>

- translate('MSC.changeSelection') ?> + translate('changeSelection', 'dc-general') ?>

diff --git a/src/Resources/public/css/generalDriver.css b/src/Resources/public/css/generalDriver.css index 44574d77..bbb2f6eb 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:1px;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}} -/*# sourceMappingURL=generalDriver.css.map */ \ No newline at end of file +@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}} +/*# sourceMappingURL=generalDriver.css.map */ diff --git a/src/Resources/public/sass/_languagePanel.scss b/src/Resources/public/sass/_languagePanel.scss index 0f49d4af..2c05d8e9 100644 --- a/src/Resources/public/sass/_languagePanel.scss +++ b/src/Resources/public/sass/_languagePanel.scss @@ -34,7 +34,7 @@ } .tl_language_panel .tl_submit { - margin-top: 1px; + margin-top: 3px; vertical-align: top; } diff --git a/src/Resources/translations/dc-general.de.xlf b/src/Resources/translations/dc-general.de.xlf new file mode 100644 index 00000000..d35d683b --- /dev/null +++ b/src/Resources/translations/dc-general.de.xlf @@ -0,0 +1,459 @@ + + + + + + Language + Sprache + + + + + Switch language + Sprache wechseln + + + + + Table: %table% + Tabelle: %table% + + + + + The property "%property%" is already in the database and not unique. + Die Eigenschaft "%property%" ist schon in der Datenbank und nicht unique. + + + + + Nothing was selected! + Es wurde nichts ausgewählt! + + + + + Ok + Ok + + + + + Abort + Abbrechen + + + + + Cancel + Beenden + + + + + Cancel multiple processing. + Die Mehrfachbearbeitung beenden. + + + + + The property "%property%" isn't supported in mode "%mode%". + Die Eigenschaft "%property%" wird im Modus "%mode%" nicht unterstützt. + + + + + You must select the property "%property%" for edit it. + Die Eigenschaft "%property%" muss ausgewählt sein, damit diese bearbeitet werden kann. + + + + + You must select the parent property "%parent_property%" for edit the property + "%edit_property%". + + Die Abhängige Eigenschaft "%parent_property%" muss ausgewählt sein, damit man die Eigenschaft + "%edit_property%" bearbeiten kann. + + + + + + Select properties + Eigenschaften auswählen + + + + + Please check your selected properties! + Bitte überprüfen Sie die ausgewählten Eigenschaften! + + + + + Select models + Elemente auswählen + + + + + Disabled: %title% + Gesperrt: %title% + + + + + Create a new item + Neuen Datensatz erstellen + + + + + Edit record %id% + Datensatz %id% bearbeiten + + + + + W Y + W. Y + + + + + Delete + Löschen + + + + + Edit + Bearbeiten + + + + + Override + Überschreiben + + + + + Copy + Kopieren + + + + + Close + Schließen + + + + + Continue + Weiter + + + + + Do you really want to delete the selected records? + Wollen Sie die ausgewählten Einträge wirklich löschen? + + + + + Delete + Löschen + + + + + Move + Verschieben + + + + + Copy + Kopieren + + + + + Edit + Bearbeiten + + + + + Override + Überschreiben + + + + + Edit multiple + Mehrere bearbeiten + + + + + no + nein + + + + + yes + ja + + + + + Show the details of record %id% + Details des Datensatzes %id% anzeigen + + + + + Color picker + Farbe auswählen + + + + + Word wrap + Zeilenumbruch + + + + + Open the help wizard + Den Hilfe-Assistent aufrufen + + + + + Change selection + Auswahl ändern + + + + + Drag the items to re-order them + Elemente können durch Ziehen umsortiert werden + + + + + Reset selection + Auswahl aufheben + + + + + Select all + Alle auswählen + + + + + Collapse node + Bereich schließen + + + + + Expand node + Bereich öffnen + + + + + Save + Speichern + + + + + Save and close + Speichern und schließen + + + + + Save and edit + Speichern und bearbeiten + + + + + Save and go back + Speichern und zurück + + + + + Save and new + Speichern und neu + + + + + Save and duplicate + Speichern und duplizieren + + + + + Go back + Zurück + + + + + Back to the previous page + Zurück zur vorherigen Seite + + + + + Revision date + Änderungsdatum + + + + + 0 + 1 + + + + + %B %d%o, %Y + %d. %B %Y + + + + + ID + ID + + + + + Parent ID + Elternelement + + + + + Sorting value + Sortierindex + + + + + Search + Suchen + + + + + Treepicker manager + Treepicker-Manager + + + + + utf-8 + utf-8 + + + + + Records + Datensätze + + + + + All + Alle + + + + + Update mode + Update-Modus + + + + + Add the selected values + Ausgewählte Werte hinzufügen + + + + + Remove the selected values + Ausgewählte Werte entfernen + + + + + Replace the existing entries + Bestehende Einträge überschreiben + + + + + Apply + Anwenden + + + + + Sort + Sortieren + + + + + Show + Anzeigen + + + + + Reset + Zurücksetzen + + + + + Version + Version + + + + + Restore + Wiederherstellen + + + + + Clear clipboard + Ablage leeren + + + + + No records found. + Keine Einträge gefunden. + + + + diff --git a/src/Resources/translations/dc-general.en.xlf b/src/Resources/translations/dc-general.en.xlf new file mode 100644 index 00000000..d80a62c4 --- /dev/null +++ b/src/Resources/translations/dc-general.en.xlf @@ -0,0 +1,382 @@ + + + + + + Language + + + + + Switch language + + + + + Table: %table% + + + + + The property "%property%" is already in the database and not unique. + + + + + Nothing was selected! + + + + + Ok + + + + + Abort + + + + + Cancel + + + + + Cancel multiple processing. + + + + + The property "%property%" isn't supported in mode "%mode%". + + + + + You must select the property "%property%" for edit it. + + + + + You must select the parent property "%parent_property%" for edit the property + "%edit_property%". + + + + + + Select properties + + + + + Please check your selected properties! + + + + + Select models + + + + + Disabled: %title% + + + + + Create a new item + + + + + Edit record %id% + + + + + W Y + + + + + Delete + + + + + Edit + + + + + Override + + + + + Copy + + + + + Close + + + + + Continue + + + + + Do you really want to delete the selected records? + + + + + Delete + + + + + Move + + + + + Copy + + + + + Edit + + + + + Override + + + + + Edit multiple + + + + + no + + + + + yes + + + + + Show the details of record %id% + + + + + Color picker + + + + + Word wrap + + + + + Open the help wizard + + + + + Change selection + + + + + Drag the items to re-order them + + + + + Reset selection + + + + + Select all + + + + + Collapse node + + + + + Expand node + + + + + Save + + + + + Save and close + + + + + Save and edit + + + + + Save and go back + + + + + Save and new + + + + + Save and duplicate + + + + + Go back + + + + + Back to the previous page + + + + + Revision date + + + + + 0 + + + + + %B %d%o, %Y + + + + + ID + + + + + Parent ID + + + + + Sorting value + + + + + Search + + + + + Treepicker manager + + + + + utf-8 + + + + + Records + + + + + All + + + + + Update mode + + + + + Add the selected values + + + + + Remove the selected values + + + + + Replace the existing entries + + + + + Apply + + + + + Sort + + + + + Show + + + + + Reset + + + + + Version + + + + + Restore + + + + + Clear clipboard + + + + + No records found. + + + + diff --git a/src/View/ActionHandler/AbstractPropertyOverrideEditAllHandler.php b/src/View/ActionHandler/AbstractPropertyOverrideEditAllHandler.php index 5f2a5978..1d447dce 100644 --- a/src/View/ActionHandler/AbstractPropertyOverrideEditAllHandler.php +++ b/src/View/ActionHandler/AbstractPropertyOverrideEditAllHandler.php @@ -514,7 +514,7 @@ protected function getEditButtons(Action $action, EnvironmentInterface $environm '', $mode, $mode, - $translator->translate('MSC.save') + $translator->translate('save', 'dc-general') ); $buttons['save'] .= ' '; @@ -523,7 +523,7 @@ protected function getEditButtons(Action $action, EnvironmentInterface $environm '', $mode, $mode, - $translator->translate('MSC.saveNback') + $translator->translate('saveNback', 'dc-general') ); $submitButtonTemplate = new ContaoBackendViewTemplate('dc_general_submit_button'); diff --git a/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php b/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php index 71fdd757..5ac0e156 100644 --- a/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php +++ b/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php @@ -3,7 +3,7 @@ /** * This file is part of contao-community-alliance/dc-general. * - * (c) 2013-2021 Contao Community Alliance. + * (c) 2013-2024 Contao Community Alliance. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -12,7 +12,8 @@ * * @package contao-community-alliance/dc-general * @author Sven Baumann - * @copyright 2013-2021 Contao Community Alliance. + * @author Ingolf Steinhardt + * @copyright 2013-2024 Contao Community Alliance. * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0 * @filesource */ @@ -21,9 +22,6 @@ use ContaoCommunityAlliance\DcGeneral\Action; use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetPropertyOptionsEvent; -use ContaoCommunityAlliance\DcGeneral\Data\ModelId; -use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface; -use ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBagInterface; use ContaoCommunityAlliance\DcGeneral\DataDefinition; use ContaoCommunityAlliance\DcGeneral\DataDefinition\ConditionChainInterface; use ContaoCommunityAlliance\DcGeneral\DataDefinition\ConditionInterface; @@ -33,6 +31,9 @@ use ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\Condition\Property\PropertyConditionInterface; use ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\Condition\Property\PropertyTrueCondition; use ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface; +use ContaoCommunityAlliance\DcGeneral\Data\ModelId; +use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface; +use ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBagInterface; use ContaoCommunityAlliance\DcGeneral\EnvironmentInterface; use ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException; use ContaoCommunityAlliance\DcGeneral\InputProviderInterface; @@ -458,9 +459,12 @@ protected function injectSelectParentPropertyInformation( $labelEditProperty = !$property->getLabel() ? $property->getName() : $property->getLabel(); $information[] = sprintf( - '

' . $translator->translate('MSC.select_parent_property_info') . '

', - $labelParentProperty, - $labelEditProperty + '

%s

', + $translator->translate( + 'select_parent_property_info', + 'dc-general', + ['%parent_property%' => $labelParentProperty, '%edit_property%' => $labelEditProperty] + ) ); } @@ -496,10 +500,11 @@ protected function injectSelectSubPropertiesInformation( foreach ($properties as $propertyName => $informationProperty) { $label = !$informationProperty->getLabel() ? $propertyName : $informationProperty->getLabel(); - $information[] = sprintf( - '

' . $translator->translate('MSC.select_property_info') . '

', - $label - ); + $information[] = + '

' . + $translator->translate('select_property_info', 'dc-general', ['%property%' => $label]) . + '

' + ; } return implode('', $information); diff --git a/tests/Contao/Event/SubscriberTest.php b/tests/Contao/Event/SubscriberTest.php index 6594b956..900a6a9f 100644 --- a/tests/Contao/Event/SubscriberTest.php +++ b/tests/Contao/Event/SubscriberTest.php @@ -283,8 +283,8 @@ public function testRenderValueIsDateTimeReadable() public function widgetCheckBoxReadableDataProvider() { return [ - [true, 'MSC.yes'], - [false, 'MSC.no'] + [true, 'yes'], + [false, 'no'] ]; }