mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-24 11:59:31 +00:00
Implementiere bevorzugte Sprachauswahl und Datenquellen-Synonyme
Die Spracheinstellungen/System-Settings wurden um die Möglichkeit ergänzt, bevorzugte Sprachen für die Dropdown-Menüs festzulegen. Zudem wurde ein Datenquellen-Synonymsystem implementiert, um benutzerfreundlichere Bezeichnungen anzuzeigen und zu personalisieren.
This commit is contained in:
parent
e53b72a8d1
commit
68e7ffa452
34 changed files with 648 additions and 44 deletions
|
|
@ -1,7 +1,9 @@
|
|||
{% extends "admin/base_admin.html.twig" %}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fas fa-tags fa-fw"></i> {% trans %}category.labelp{% endtrans %}
|
||||
{% set dataSourceName = get_data_source_name('category', 'category.labelp') %}
|
||||
{% set translatedSource = 'category.labelp'|trans %}
|
||||
<i class="fas fa-tags fa-fw"></i> {% if dataSourceName != translatedSource %}{{ 'datasource.synonym'|trans({'%name%': translatedSource, '%synonym%': dataSourceName}) }}{% else %}{{ translatedSource }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block additional_pills %}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
{% extends "admin/base_admin.html.twig" %}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fas fa-microchip fa-fw"></i> {% trans %}footprint.labelp{% endtrans %}
|
||||
{% set dataSourceName = get_data_source_name('footprint', 'footprint.labelp') %}
|
||||
{% set translatedSource = 'footprint.labelp'|trans %}
|
||||
<i class="fas fa-microchip fa-fw"></i> {% if dataSourceName != translatedSource %}{{ 'datasource.synonym'|trans({'%name%': translatedSource, '%synonym%': dataSourceName}) }}{% else %}{{ translatedSource }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block master_picture_block %}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
{% extends "admin/base_company_admin.html.twig" %}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fas fa-industry fa-fw"></i> {% trans %}manufacturer.caption{% endtrans %}
|
||||
{% set dataSourceName = get_data_source_name('manufacturer', 'manufacturer.caption') %}
|
||||
{% set translatedSource = 'manufacturer.caption'|trans %}
|
||||
<i class="fas fa-industry fa-fw"></i> {% if dataSourceName != translatedSource %}{{ 'datasource.synonym'|trans({'%name%': translatedSource, '%synonym%': dataSourceName}) }}{% else %}{{ translatedSource }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_title %}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
{# @var entity App\Entity\ProjectSystem\Project #}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fas fa-archive fa-fw"></i> {% trans %}project.caption{% endtrans %}
|
||||
{% set dataSourceName = get_data_source_name('project', 'project.caption') %}
|
||||
{% set translatedSource = 'project.caption'|trans %}
|
||||
<i class="fas fa-archive fa-fw"></i> {% if dataSourceName != translatedSource %}{{ 'datasource.synonym'|trans({'%name%': translatedSource, '%synonym%': dataSourceName}) }}{% else %}{{ translatedSource }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_title %}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
{% import "label_system/dropdown_macro.html.twig" as dropdown %}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fas fa-cube fa-fw"></i> {% trans %}storelocation.labelp{% endtrans %}
|
||||
{% set dataSourceName = get_data_source_name('storagelocation', 'storelocation.labelp') %}
|
||||
{% set translatedSource = 'storelocation.labelp'|trans %}
|
||||
<i class="fas fa-cube fa-fw"></i> {% if dataSourceName != translatedSource %}{{ 'datasource.synonym'|trans({'%name%': translatedSource, '%synonym%': dataSourceName}) }}{% else %}{{ translatedSource }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block additional_controls %}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
{% extends "admin/base_company_admin.html.twig" %}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fas fa-truck fa-fw"></i> {% trans %}supplier.caption{% endtrans %}
|
||||
{% set dataSourceName = get_data_source_name('supplier', 'supplier.caption') %}
|
||||
{% set translatedSource = 'supplier.caption'|trans %}
|
||||
<i class="fas fa-truck fa-fw"></i> {% if dataSourceName != translatedSource %}{{ 'datasource.synonym'|trans({'%name%': translatedSource, '%synonym%': dataSourceName}) }}{% else %}{{ translatedSource }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block additional_panes %}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
{% macro sidebar_dropdown() %}
|
||||
{% set currentLocale = app.request.locale %}
|
||||
|
||||
{# Format is [mode, route, label, show_condition] #}
|
||||
{% set data_sources = [
|
||||
['categories', path('tree_category_root'), 'category.labelp', is_granted('@categories.read') and is_granted('@parts.read')],
|
||||
['locations', path('tree_location_root'), 'storelocation.labelp', is_granted('@storelocations.read') and is_granted('@parts.read')],
|
||||
['footprints', path('tree_footprint_root'), 'footprint.labelp', is_granted('@footprints.read') and is_granted('@parts.read')],
|
||||
['manufacturers', path('tree_manufacturer_root'), 'manufacturer.labelp', is_granted('@manufacturers.read') and is_granted('@parts.read')],
|
||||
['suppliers', path('tree_supplier_root'), 'supplier.labelp', is_granted('@suppliers.read') and is_granted('@parts.read')],
|
||||
['projects', path('tree_device_root'), 'project.labelp', is_granted('@projects.read')],
|
||||
['tools', path('tree_tools'), 'tools.label', true],
|
||||
['categories', path('tree_category_root'), 'category.labelp', is_granted('@categories.read') and is_granted('@parts.read'), 'category'],
|
||||
['locations', path('tree_location_root'), 'storelocation.labelp', is_granted('@storelocations.read') and is_granted('@parts.read'), 'storagelocation'],
|
||||
['footprints', path('tree_footprint_root'), 'footprint.labelp', is_granted('@footprints.read') and is_granted('@parts.read'), 'footprint'],
|
||||
['manufacturers', path('tree_manufacturer_root'), 'manufacturer.labelp', is_granted('@manufacturers.read') and is_granted('@parts.read'), 'manufacturer'],
|
||||
['suppliers', path('tree_supplier_root'), 'supplier.labelp', is_granted('@suppliers.read') and is_granted('@parts.read'), 'supplier'],
|
||||
['projects', path('tree_device_root'), 'project.labelp', is_granted('@projects.read'), 'project'],
|
||||
['tools', path('tree_tools'), 'tools.label', true, 'tool'],
|
||||
] %}
|
||||
|
||||
<li class="dropdown-header">{% trans %}actions{% endtrans %}</li>
|
||||
|
|
@ -18,9 +20,9 @@
|
|||
|
||||
{% for source in data_sources %}
|
||||
{% if source[3] %} {# show_condition #}
|
||||
<li><button class="tree-btns dropdown-item" data-mode="{{ source[0] }}" data-url="{{ source[1] }}" data-text="{{ source[2] | trans }}"
|
||||
<li><button class="tree-btns dropdown-item" data-mode="{{ source[0] }}" data-url="{{ source[1] }}" data-text="{{ get_data_source_name(source[4], source[2]) }}"
|
||||
{{ stimulus_action('elements/sidebar_tree', 'changeDataSource') }}
|
||||
>{{ source[2] | trans }}</button></li>
|
||||
>{{ get_data_source_name(source[4], source[2]) }}</button></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
|
@ -61,4 +63,4 @@
|
|||
|
||||
<div class="treeview-sm mt-2" {{ stimulus_target('elements/tree', 'tree') }}></div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
{% endmacro %}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,34 @@
|
|||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input tristate permission-checkbox permission_multicheckbox" id="mulit_check_{{ form.vars.label }}">
|
||||
<label class="form-check-label" for="mulit_check_{{ form.vars.label }}">
|
||||
<b>{{ form.vars.label | trans }}</b>
|
||||
{% set dataSource = '' %}
|
||||
{% if (form.vars.label == 'perm.part.categories') %}
|
||||
{% set dataSource = 'category' %}
|
||||
{% elseif (form.vars.label == 'perm.storelocations') %}
|
||||
{% set dataSource = 'storagelocation' %}
|
||||
{% elseif (form.vars.label == 'perm.part.footprints') %}
|
||||
{% set dataSource = 'footprint' %}
|
||||
{% elseif (form.vars.label == 'perm.part.manufacturers') %}
|
||||
{% set dataSource = 'manufacturer' %}
|
||||
{% elseif (form.vars.label == 'perm.part.supplier') %}
|
||||
{% set dataSource = 'supplier' %}
|
||||
{% elseif (form.vars.label == 'perm.projects') %}
|
||||
{% set dataSource = 'project' %}
|
||||
{% endif %}
|
||||
|
||||
{% set dataSourceName = get_data_source_name(dataSource, form.vars.label) %}
|
||||
{% set translatedSource = form.vars.label|trans %}
|
||||
{% if dataSourceName != translatedSource %}
|
||||
{{ translatedSource }}
|
||||
<i class="fas fa-fw fa-info" title="{{ 'datasource.synonym'|trans({'%name%': '', '%synonym%': dataSourceName })|raw }}"></i>
|
||||
{% else %}
|
||||
{{ translatedSource }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<b>{{ form.vars.label | trans }}</b>
|
||||
<b>def{{ form.vars.label | trans }}</b>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue