mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-08 12:09:30 +00:00
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
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:
parent
443cb57ce8
commit
a356eecd74
5 changed files with 19 additions and 30 deletions
|
|
@ -18,7 +18,7 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
|
||||
parts: # e.g. this maps to perms_parts in User/Group database
|
||||
group: "data"
|
||||
label: "{{part}}"
|
||||
label: "[[Part]]"
|
||||
operations: # Here are all possible operations are listed => the op name is mapped to bit value
|
||||
read:
|
||||
label: "perm.read"
|
||||
|
|
@ -71,7 +71,7 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
|
||||
|
||||
storelocations: &PART_CONTAINING
|
||||
label: "{{storage_location}}"
|
||||
label: "[[Storage_location]]"
|
||||
group: "data"
|
||||
operations:
|
||||
read:
|
||||
|
|
@ -103,39 +103,39 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
|
||||
footprints:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{footprint}}"
|
||||
label: "[[Footprint]]"
|
||||
|
||||
categories:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{category}}"
|
||||
label: "[[Category]]"
|
||||
|
||||
suppliers:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{supplier}}"
|
||||
label: "[[Supplier]]"
|
||||
|
||||
manufacturers:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{manufacturer}}"
|
||||
label: "[[Manufacturer]]"
|
||||
|
||||
projects:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{project}}"
|
||||
label: "[[Project]]"
|
||||
|
||||
attachment_types:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{attachment_type}}"
|
||||
label: "[[Attachment_type]]"
|
||||
|
||||
currencies:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{currency}}"
|
||||
label: "[[Currency]]"
|
||||
|
||||
measurement_units:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{measurement_unit}}"
|
||||
label: "[[Measurement_unit]]"
|
||||
|
||||
part_custom_states:
|
||||
<<: *PART_CONTAINING
|
||||
label: "{{part_custom_state}}"
|
||||
label: "[[Part_custom_state]]"
|
||||
|
||||
tools:
|
||||
label: "perm.part.tools"
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -40,10 +40,11 @@ class RegisterSynonymsAsTranslationParametersTest extends KernelTestCase
|
|||
$placeholders = $this->listener->getSynonymPlaceholders();
|
||||
|
||||
$this->assertIsArray($placeholders);
|
||||
$this->assertSame('Part', $placeholders['{part}']);
|
||||
$this->assertSame('Parts', $placeholders['{{part}}']);
|
||||
//Lowercase versions:
|
||||
// Curly braces for lowercase versions
|
||||
$this->assertSame('part', $placeholders['[part]']);
|
||||
$this->assertSame('parts', $placeholders['[[part]]']);
|
||||
// Square brackets for capitalized versions (with capital first letter in placeholder)
|
||||
$this->assertSame('Part', $placeholders['[Part]']);
|
||||
$this->assertSame('Parts', $placeholders['[[Part]]']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14297,12 +14297,6 @@ Bitte beachten Sie, dass dieses System derzeit experimentell ist und die hier de
|
|||
<target>Mit Typsynonymen können Sie die Bezeichnungen von integrierten Datentypen ersetzen. Zum Beispiel können Sie „Footprint" in etwas anderes umbenennen.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="GSqBiVV" name="{{part}}">
|
||||
<segment>
|
||||
<source>{{part}}</source>
|
||||
<target>Bauteile</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="wjcsjzT" name="log.element_edited.changed_fields.part_ipn_prefix">
|
||||
<segment>
|
||||
<source>log.element_edited.changed_fields.part_ipn_prefix</source>
|
||||
|
|
|
|||
|
|
@ -14146,12 +14146,6 @@ Please note that this system is currently experimental, and the synonyms defined
|
|||
<target>Type synonyms allow you to replace the labels of built-in data types. For example, you can rename "Footprint" to something else.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="GSqBiVV" name="{{part}}">
|
||||
<segment>
|
||||
<source>{{part}}</source>
|
||||
<target>Parts</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="wjcsjzT" name="log.element_edited.changed_fields.part_ipn_prefix">
|
||||
<segment>
|
||||
<source>log.element_edited.changed_fields.part_ipn_prefix</source>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue