Skip to content

Commit

Permalink
Changes for MM xliff
Browse files Browse the repository at this point in the history
  • Loading branch information
zonky2 committed May 13, 2024
1 parent 5b8a374 commit 8b77c02
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ protected function getPropertyLabel(EnvironmentInterface $environment, PropertyI

$key = $property->getLabel();

if ('' === $key || null === $key) {
if ('' === $key) {
throw new LogicException('Missing label for property ' . $property->getName());
}

Expand Down
8 changes: 7 additions & 1 deletion src/Contao/View/Contao2BackendView/ButtonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,13 @@ protected function translateButtonDescription(
if (
1 !== preg_match('#%(?:[bcdeEfFgGhHosuxX]|\d*\$[bcdeEfFgGhHosuxX])#', $buttonName)
&& $definitionName . '.' . $buttonName . '.1'
!== ($header = $this->translator->translate($definitionName . '.' . $buttonName . '.1', 'contao_' . $definitionName, $parameter))
!== (
$header = $this->translator->translate(
$definitionName . '.' . $buttonName . '.1',
'contao_' . $definitionName,
$parameter
)
)
) {
return $header;
}
Expand Down
9 changes: 8 additions & 1 deletion src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public function render()
* @param CommandInterface $command The command definition.
*
* @return string
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
private function renderButton(CommandInterface $command)
{
Expand Down Expand Up @@ -197,8 +200,12 @@ private function translate(string $path): string
if ($path !== ($value = $this->translator->translate($path, $domain))) {
return $value;
}

// Fallback translate for non symfony domain.
if ($domain . '.' . $path !== ($value = $this->translator->translate($domain . '.' . $path, 'contao_' . $domain))) {
if (
$domain . '.' . $path !== ($value =
$this->translator->translate($domain . '.' . $path, 'contao_' . $domain))
) {
return $value;
}

Expand Down

0 comments on commit 8b77c02

Please sign in to comment.