Replace type synonym placeholders with bracket notation for better DX (#1133)
Some checks are pending
Build assets artifact / Build assets artifact (push) Waiting to run
Docker Image Build / docker (push) Waiting to run
Docker Image Build (FrankenPHP) / docker (push) Waiting to run
Static analysis / Static analysis (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, sqlite) (push) Waiting to run

* Initial plan

* Replace placeholder syntax for type synonyms to be more DX friendly

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>

* Update translation files to use new placeholder syntax

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>

* Use mb_strtoupper with mb_substr for Unicode consistency

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>

* Make placeholder generation right

* Removed obsolete transltions

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
Co-authored-by: Jan Böhmer <mail@jan-boehmer.de>
This commit is contained in:
Copilot 2025-12-06 23:29:32 +01:00 committed by GitHub
parent 443cb57ce8
commit a356eecd74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 30 deletions

View file

@ -60,10 +60,10 @@ readonly class RegisterSynonymsAsTranslationParametersListener
//Generate a placeholder for each element type
foreach (ElementTypes::cases() as $elementType) {
//We have a placeholder for singular
$placeholders['{' . $elementType->value . '}'] = $this->typeNameGenerator->typeLabel($elementType);
//We have a placeholder for plural
$placeholders['{{' . $elementType->value . '}}'] = $this->typeNameGenerator->typeLabelPlural($elementType);
//Versions with capitalized first letter
$capitalized = ucfirst($elementType->value); //We have only ASCII element type values, so this is sufficient
$placeholders['[' . $capitalized . ']'] = $this->typeNameGenerator->typeLabel($elementType);
$placeholders['[[' . $capitalized . ']]'] = $this->typeNameGenerator->typeLabelPlural($elementType);
//And we have lowercase versions for both
$placeholders['[' . $elementType->value . ']'] = mb_strtolower($this->typeNameGenerator->typeLabel($elementType));