This commit is contained in:
team 1
2026-05-04 16:33:36 +02:00
parent 33b2b30d99
commit 387506b239
13 changed files with 198 additions and 57 deletions

View File

@@ -2,19 +2,20 @@
namespace App\Service;
use App\Config\LanguageCleanupConfig;
class FormatText
{
public function __construct(private readonly LanguageCleanupConfig $languageCleanupConfig)
{
}
function slugify(string $text): string
{
$text = mb_strtolower($text, 'UTF-8');
// Umlaute ersetzen
$replacements = [
'ä' => 'ae',
'ö' => 'oe',
'ü' => 'ue',
'ß' => 'ss'
];
// Use YAML-backed language normalization instead of a PHP-owned list.
$replacements = $this->languageCleanupConfig->getAsciiTransliterationMap();
$text = str_replace(array_keys($replacements), $replacements, $text);
// Nicht erlaubte Zeichen entfernen
@@ -27,4 +28,4 @@ class FormatText
return trim($text, '-');
}
}
}