mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Show plural translation for entity type labels in synonym settings
This commit is contained in:
parent
819a8cc56d
commit
3459731ca8
2 changed files with 54 additions and 1 deletions
|
|
@ -32,6 +32,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Intl\Locales;
|
use Symfony\Component\Intl\Locales;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single translation row: data source + language + translations (singular/plural).
|
* A single translation row: data source + language + translations (singular/plural).
|
||||||
|
|
@ -50,6 +51,7 @@ class TypeSynonymRowType extends AbstractType
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly LocalizationSettings $localizationSettings,
|
private readonly LocalizationSettings $localizationSettings,
|
||||||
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire(param: 'partdb.locale_menu')] private readonly array $preferredLanguagesParam,
|
#[Autowire(param: 'partdb.locale_menu')] private readonly array $preferredLanguagesParam,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
@ -64,6 +66,9 @@ class TypeSynonymRowType extends AbstractType
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new Assert\NotBlank(),
|
new Assert\NotBlank(),
|
||||||
],
|
],
|
||||||
|
'choice_label' => function (ElementTypes $choice) {
|
||||||
|
return $this->translator->trans($choice->getDefaultLabelKey()) . ' (' . $this->translator->trans($choice->getDefaultPluralLabelKey()) . ')';
|
||||||
|
},
|
||||||
'row_attr' => ['class' => 'mb-0'],
|
'row_attr' => ['class' => 'mb-0'],
|
||||||
'attr' => ['class' => 'form-select-sm'],
|
'attr' => ['class' => 'form-select-sm'],
|
||||||
'preferred_choices' => self::PREFERRED_TYPES
|
'preferred_choices' => self::PREFERRED_TYPES
|
||||||
|
|
|
||||||
|
|
@ -3448,7 +3448,7 @@ Sub elements will be moved upwards.]]></target>
|
||||||
</notes>
|
</notes>
|
||||||
<segment state="translated">
|
<segment state="translated">
|
||||||
<source>group.label</source>
|
<source>group.label</source>
|
||||||
<target>Group:</target>
|
<target>Group</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="6KVtnw_" name="user.permissions">
|
<unit id="6KVtnw_" name="user.permissions">
|
||||||
|
|
@ -14412,5 +14412,53 @@ Please note that this system is currently experimental, and the synonyms defined
|
||||||
<target>Parts</target>
|
<target>Parts</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id=".tjK0ju" name="project_bom_entry.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>project_bom_entry.labelp</source>
|
||||||
|
<target>BOM entries</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="ftBf11d" name="part_lot.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>part_lot.labelp</source>
|
||||||
|
<target>Part lots</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="UVDJmYp" name="orderdetail.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>orderdetail.labelp</source>
|
||||||
|
<target>Order details</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="83AQqv." name="pricedetail.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>pricedetail.labelp</source>
|
||||||
|
<target>Price details</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4KRV2mB" name="parameter.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>parameter.labelp</source>
|
||||||
|
<target>Parameters</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="AAYYeiw" name="part_association.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>part_association.labelp</source>
|
||||||
|
<target>Part associations</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="2_3Lz7i" name="bulk_info_provider_import_job.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>bulk_info_provider_import_job.labelp</source>
|
||||||
|
<target>Bulk info provider imports</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="BXTqi16" name="bulk_info_provider_import_job_part.labelp">
|
||||||
|
<segment>
|
||||||
|
<source>bulk_info_provider_import_job_part.labelp</source>
|
||||||
|
<target>Bulk import job part</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue