Use mb_strtoupper with mb_substr for Unicode consistency

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-06 21:46:29 +00:00
parent 97f4d22292
commit 9e095ec1c8

View file

@ -69,7 +69,8 @@ readonly class RegisterSynonymsAsTranslationParametersListener
$placeholders['{{' . $elementType->value . '}}'] = mb_strtolower($capitalizedPlural); $placeholders['{{' . $elementType->value . '}}'] = mb_strtolower($capitalizedPlural);
// Square brackets for capitalized versions (with capital first letter in placeholder) // Square brackets for capitalized versions (with capital first letter in placeholder)
$capitalizedKey = ucfirst($elementType->value); // Use mb_strtoupper for the first character to handle multibyte strings consistently
$capitalizedKey = mb_strtoupper(mb_substr($elementType->value, 0, 1)) . mb_substr($elementType->value, 1);
$placeholders['[' . $capitalizedKey . ']'] = $capitalizedSingular; $placeholders['[' . $capitalizedKey . ']'] = $capitalizedSingular;
$placeholders['[[' . $capitalizedKey . ']]'] = $capitalizedPlural; $placeholders['[[' . $capitalizedKey . ']]'] = $capitalizedPlural;
} }