mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Refactor title translation logic in SpreadSheetFormatter.
Simplified and streamlined the handling of title translation. Added truncation for titles exceeding 30 characters to ensure proper formatting. This enhances code readability and ensures title length consistency.
This commit is contained in:
parent
ff6ec45575
commit
6d76b94644
@ -443,10 +443,16 @@ class SpreadSheetFormatter implements FormatterInterface, ExportManagerAwareInte
|
|||||||
$original = $this->export->getTitle();
|
$original = $this->export->getTitle();
|
||||||
|
|
||||||
if ($original instanceof TranslatableInterface) {
|
if ($original instanceof TranslatableInterface) {
|
||||||
return $original->trans($this->translator, $this->translator->getLocale());
|
$title = $original->trans($this->translator, $this->translator->getLocale());
|
||||||
|
} else {
|
||||||
|
$title = $this->translator->trans($original);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->translator->trans($original);
|
if (30 < strlen($title)) {
|
||||||
|
return substr($title, 0, 30).'…';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initializeCache($key)
|
protected function initializeCache($key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user