{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2025 Teclib' and contributors. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {% macro getTranslationInput(handler, translation) %} {% import 'components/form/fields_macros.html.twig' as fields %} {% set rand = random() %}
{% if translation and translation.isPossiblyObsolete() %} {% endif %} {% set current_translation = '' %} {% if translation %} {% set current_translation = translation.getTranslation() %} {% endif %} {% if handler.isRichText() %} {{ fields.textareaField( 'translations[%s][translations][one]'|format(rand), current_translation, '', { 'no_label' : true, 'full_width' : true, 'mb' : '', 'aria_label' : __("Enter translation"), 'placeholder' : __("Enter translation"), 'enable_richtext': true, 'statusbar' : false, 'editor_height' : 0, 'init' : false, 'init_on_demand' : true, } ) }} {% else %} {% endif %}
{% endmacro %} {% set entries = [] %} {% for handlers in item.listTranslationsHandlers() %} {% set entries = entries|merge([{ 'type': '' ~ handlers|first.getCategory() ~ '', 'type_colspan': 3, 'type_aria_label': _n('Category', 'Categories', 1) }]) %} {% for handler in handlers %} {% set entries = entries|merge([{ 'type': '' ~ handler.getName() ~ '', 'default': handler.isRichText() ? handler.getValue()|safe_html : handler.getValue()|e, 'translation': _self.getTranslationInput( handler, helpdesk_translation.getForItemKeyAndLanguage( handler.getItem(), handler.getKey(), helpdesk_translation.fields['language'] ) ), 'type_aria_label': __('Translation name'), 'default_aria_label': __('Default value'), 'translation_aria_label': __('Translated value') }]) %} {% endfor %} {% endfor %}