mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +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:
@@ -443,10 +443,16 @@ class SpreadSheetFormatter implements FormatterInterface, ExportManagerAwareInte
|
||||
$original = $this->export->getTitle();
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user