mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Reworked settings name and translation
This commit is contained in:
parent
a0a12b8692
commit
446f4a662d
9 changed files with 46 additions and 182 deletions
|
|
@ -34,7 +34,7 @@ use App\Entity\PriceInformations\Pricedetail;
|
|||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use App\Exceptions\EntityNotSupportedException;
|
||||
use App\Settings\SystemSettings\DataSourceSynonymsSettings;
|
||||
use App\Settings\SynonymSettings;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +46,7 @@ final readonly class ElementTypeNameGenerator
|
|||
public function __construct(
|
||||
private TranslatorInterface $translator,
|
||||
private EntityURLGenerator $entityURLGenerator,
|
||||
private DataSourceSynonymsSettings $synonymsSettings,
|
||||
private SynonymSettings $synonymsSettings,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ use App\Services\Cache\ElementCacheTagGenerator;
|
|||
use App\Services\Cache\UserCacheKeyGenerator;
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use App\Services\Misc\DataSourceSynonymResolver;
|
||||
use App\Settings\BehaviorSettings\SidebarSettings;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
|
|
@ -68,7 +67,6 @@ class TreeViewGenerator
|
|||
protected TranslatorInterface $translator,
|
||||
private readonly UrlGeneratorInterface $router,
|
||||
private readonly SidebarSettings $sidebarSettings,
|
||||
protected readonly DataSourceSynonymResolver $synonymResolver,
|
||||
private readonly ElementTypeNameGenerator $elementTypeNameGenerator
|
||||
) {
|
||||
$this->rootNodeEnabled = $this->sidebarSettings->rootNodeEnabled;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@ class AppSettings
|
|||
#[EmbeddedSettings()]
|
||||
public ?InfoProviderSettings $infoProviders = null;
|
||||
|
||||
#[EmbeddedSettings]
|
||||
public ?SynonymSettings $synonyms = null;
|
||||
|
||||
#[EmbeddedSettings()]
|
||||
public ?MiscSettings $miscSettings = null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,30 +20,28 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Settings\SystemSettings;
|
||||
namespace App\Settings;
|
||||
|
||||
use App\Form\Type\DataSourceSynonymsCollectionType;
|
||||
use App\Services\ElementTypes;
|
||||
use App\Settings\SettingsIcon;
|
||||
use Jbtronics\SettingsBundle\ParameterTypes\ArrayType;
|
||||
use Jbtronics\SettingsBundle\ParameterTypes\SerializeType;
|
||||
use Jbtronics\SettingsBundle\ParameterTypes\StringType;
|
||||
use Jbtronics\SettingsBundle\Settings\Settings;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsTrait;
|
||||
use Symfony\Component\Translation\TranslatableMessage as TM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[Settings(label: new TM("settings.system.data_source_synonyms"))]
|
||||
#[Settings(label: new TM("settings.system.synonyms"), description: "settings.system.synonyms.help")]
|
||||
#[SettingsIcon("fa-language")]
|
||||
class DataSourceSynonymsSettings
|
||||
class SynonymSettings
|
||||
{
|
||||
use SettingsTrait;
|
||||
|
||||
#[SettingsParameter(
|
||||
ArrayType::class,
|
||||
label: new TM("settings.system.data_source_synonyms.configuration"),
|
||||
description: new TM("settings.system.data_source_synonyms.configuration.help"),
|
||||
label: new TM("settings.system.synonyms.type_synonyms"),
|
||||
description: new TM("settings.system.synonyms.type_synonyms.help"),
|
||||
options: ['type' => SerializeType::class],
|
||||
formType: DataSourceSynonymsCollectionType::class,
|
||||
formOptions: [
|
||||
|
|
@ -53,7 +51,7 @@ class DataSourceSynonymsSettings
|
|||
#[Assert\Type('array')]
|
||||
#[Assert\All([new Assert\Type('array')])]
|
||||
/**
|
||||
* @var array<string, array<string, array{singular: string, plural: string}>> $customTypeLabels
|
||||
* @var array<string, array<string, array{singular: string, plural: string}>> $typeSynonyms
|
||||
* An array of the form: [
|
||||
* 'category' => [
|
||||
* 'en' => ['singular' => 'Category', 'plural' => 'Categories'],
|
||||
|
|
@ -64,7 +62,7 @@ class DataSourceSynonymsSettings
|
|||
* ],
|
||||
* ]
|
||||
*/
|
||||
public array $customTypeLabels = [];
|
||||
public array $typeSynonyms = [];
|
||||
|
||||
/**
|
||||
* Checks if there is any synonym defined for the given type (no matter which language).
|
||||
|
|
@ -73,7 +71,7 @@ class DataSourceSynonymsSettings
|
|||
*/
|
||||
public function isSynonymDefinedForType(ElementTypes $type): bool
|
||||
{
|
||||
return isset($this->customTypeLabels[$type->value]);
|
||||
return isset($this->typeSynonyms[$type->value]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -84,7 +82,7 @@ class DataSourceSynonymsSettings
|
|||
*/
|
||||
public function getSingularSynonymForType(ElementTypes $type, string $locale): ?string
|
||||
{
|
||||
return $this->customTypeLabels[$type->value][$locale]['singular'] ?? null;
|
||||
return $this->typeSynonyms[$type->value][$locale]['singular'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,8 +93,8 @@ class DataSourceSynonymsSettings
|
|||
*/
|
||||
public function getPluralSynonymForType(ElementTypes $type, ?string $locale): ?string
|
||||
{
|
||||
return $this->customTypeLabels[$type->value][$locale]['plural']
|
||||
?? $this->customTypeLabels[$type->value][$locale]['singular']
|
||||
return $this->typeSynonyms[$type->value][$locale]['plural']
|
||||
?? $this->typeSynonyms[$type->value][$locale]['singular']
|
||||
?? null;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,8 +33,7 @@ class SystemSettings
|
|||
#[EmbeddedSettings()]
|
||||
public ?LocalizationSettings $localization = null;
|
||||
|
||||
#[EmbeddedSettings]
|
||||
public ?DataSourceSynonymsSettings $dataSourceSynonyms = null;
|
||||
|
||||
|
||||
#[EmbeddedSettings()]
|
||||
public ?CustomizationSettings $customization = null;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
{% for section_widget in tab_widget %}
|
||||
{% set settings_object = section_widget.vars.value %}
|
||||
|
||||
{% if section_widget.vars.compound ?? false %}
|
||||
{% if section_widget.vars.embedded_settings_metadata is defined %} {# Check if we have nested embedded settings or not #}
|
||||
<fieldset>
|
||||
<legend class="offset-3">
|
||||
<i class="fa-solid {{ settings_icon(settings_object)|default('fa-sliders') }} fa-fw"></i>
|
||||
|
|
|
|||
|
|
@ -12813,60 +12813,6 @@ Vezměte prosím na vědomí, že se nemůžete vydávat za uživatele se zakáz
|
|||
<target>Jazyky, které se zobrazují v uživatelské rozbalovací nabídce</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="o6zcqUt" name="settings.system.data_source_synonyms">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms</source>
|
||||
<target>Synonyma zdrojů dat</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="kue6Tga" name="settings.system.data_source_synonyms.configuration">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms.configuration</source>
|
||||
<target>Zdroj</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="lEcz6N1" name="settings.system.data_source_synonyms.configuration.help">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms.configuration.help</source>
|
||||
<target>Definujte vlastní synonyma pro zadané zdroje dat. Volně přidávat zdroj dat, jazyk a překlady; Jazyky, které se nepoužívají, zůstávají prázdné.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="kd8nBt4" name="settings.behavior.data_source_synonyms.category">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.category</source>
|
||||
<target>Kategorie</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="id3hnbC" name="settings.behavior.data_source_synonyms.storagelocation">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.storagelocation</source>
|
||||
<target>Skladové umístění</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="kdz5RcV" name="settings.behavior.data_source_synonyms.footprint">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.footprint</source>
|
||||
<target>Pouzdro</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="uBeDc7l" name="settings.behavior.data_source_synonyms.manufacturer">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.manufacturer</source>
|
||||
<target>Výrobce</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="OewynB4" name="settings.behavior.data_source_synonyms.supplier">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.supplier</source>
|
||||
<target>Dodavatel</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="n7ze4lk" name="settings.behavior.data_source_synonyms.project">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.project</source>
|
||||
<target>Projekt</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="dGuR4cl" name="settings.behavior.data_source_synonyms.collection.add_entry">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.collection.add_entry</source>
|
||||
|
|
|
|||
|
|
@ -12881,60 +12881,6 @@ Bitte beachten Sie, dass Sie sich nicht als deaktivierter Benutzer ausgeben kön
|
|||
<b>Bitte beachten Sie, dass die Währungen bei einer Änderung dieses Wertes nicht umgerechnet werden. Wenn Sie also die Basiswährung ändern, nachdem Sie bereits Preisinformationen hinzugefügt haben, führt dies zu falschen Preisen!</b>]]></target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="o6zcqUt" name="settings.system.data_source_synonyms">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms</source>
|
||||
<target>Datenquellen-Synonyme</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="kue6Tga" name="settings.system.data_source_synonyms.configuration">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms.configuration</source>
|
||||
<target>Quelle</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="lEcz6N1" name="settings.system.data_source_synonyms.configuration.help">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms.configuration.help</source>
|
||||
<target>Definieren Sie Ihre eigenen Synonyme für die angegebenen Datenquellen. Datenquelle, Sprache und Übersetzungen frei hinzufügen; Nicht verwendete Sprachen bleiben leer.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="kd8nBt4" name="settings.behavior.data_source_synonyms.category">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.category</source>
|
||||
<target>Kategorie</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="id3hnbC" name="settings.behavior.data_source_synonyms.storagelocation">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.storagelocation</source>
|
||||
<target>Lagerort</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="kdz5RcV" name="settings.behavior.data_source_synonyms.footprint">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.footprint</source>
|
||||
<target>Footprint</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="uBeDc7l" name="settings.behavior.data_source_synonyms.manufacturer">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.manufacturer</source>
|
||||
<target>Hersteller</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="OewynB4" name="settings.behavior.data_source_synonyms.supplier">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.supplier</source>
|
||||
<target>Lieferant</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="n7ze4lk" name="settings.behavior.data_source_synonyms.project">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.project</source>
|
||||
<target>Projekt</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="dGuR4cl" name="settings.behavior.data_source_synonyms.collection.add_entry">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.collection.add_entry</source>
|
||||
|
|
|
|||
|
|
@ -12816,60 +12816,6 @@ Please note, that you can not impersonate a disabled user. If you try you will g
|
|||
<b>Please note that the currencies are not converted, when changing this value. So changing the default currency after you already added price information, will result in wrong prices!</b>]]></target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="2ChJxDR" name="settings.system.data_source_synonyms">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms</source>
|
||||
<target>Data source synonyms</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="ScBY7AG" name="settings.system.data_source_synonyms.configuration">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms.configuration</source>
|
||||
<target>Source</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="BgO4r9I" name="settings.system.data_source_synonyms.configuration.help">
|
||||
<segment state="translated">
|
||||
<source>settings.system.data_source_synonyms.configuration.help</source>
|
||||
<target>Define your own synonyms for the given data sources. Add data source, language and translations freely; unused languages remain empty.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="5vyyr9P" name="settings.behavior.data_source_synonyms.category">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.category</source>
|
||||
<target>Category</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="wFEJU6v" name="settings.behavior.data_source_synonyms.storagelocation">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.storagelocation</source>
|
||||
<target>Storage location</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id=".MopkkR" name="settings.behavior.data_source_synonyms.footprint">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.footprint</source>
|
||||
<target>Footprint</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="juUDNRe" name="settings.behavior.data_source_synonyms.manufacturer">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.manufacturer</source>
|
||||
<target>Manufacturer</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="4tbzqwK" name="settings.behavior.data_source_synonyms.supplier">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.supplier</source>
|
||||
<target>Supplier</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="wkXHGxb" name="settings.behavior.data_source_synonyms.project">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.project</source>
|
||||
<target>Project</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="hgZ7RL9" name="settings.behavior.data_source_synonyms.collection.add_entry">
|
||||
<segment state="translated">
|
||||
<source>settings.behavior.data_source_synonyms.collection.add_entry</source>
|
||||
|
|
@ -14515,5 +14461,30 @@ You can do this in the provider info list.</target>
|
|||
<target>Groups</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="q7Fs2zm" name="settings.system.synonyms">
|
||||
<segment>
|
||||
<source>settings.system.synonyms</source>
|
||||
<target>Synonyms</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="4ySREb5" name="settings.system.synonyms.help">
|
||||
<segment>
|
||||
<source>settings.system.synonyms.help</source>
|
||||
<target>The synonyms systems allow overriding how Part-DB call certain things. This can be useful, especially if Part-DB is used in a different context than electronics.
|
||||
Please note that this system is currently experimental, and the synonyms defined here might not show up at all places.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="uqVQTKd" name="settings.system.synonyms.type_synonyms">
|
||||
<segment>
|
||||
<source>settings.system.synonyms.type_synonyms</source>
|
||||
<target>Type synonyms</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="wK6CEkB" name="settings.system.synonyms.type_synonyms.help">
|
||||
<segment>
|
||||
<source>settings.system.synonyms.type_synonyms.help</source>
|
||||
<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>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue