From c8526ab0a763589dddc155014f26d1f318a55811 Mon Sep 17 00:00:00 2001
From: Sebastian Castro <sebastian.castro@protonmail.com>
Date: Sun, 2 May 2021 10:43:07 +0200
Subject: [PATCH] i18n: rename form_builder keys

---
 .../custom-fields/form-builder.html.twig      | 86 +++++++++----------
 translations/javascripts-translations.fr.yaml |  4 +-
 2 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/templates/admin/core_custom/custom-fields/form-builder.html.twig b/templates/admin/core_custom/custom-fields/form-builder.html.twig
index 3ea707b5d..f83b8457b 100755
--- a/templates/admin/core_custom/custom-fields/form-builder.html.twig
+++ b/templates/admin/core_custom/custom-fields/form-builder.html.twig
@@ -15,47 +15,47 @@
       var fbEditor = document.getElementById('form-builder-container');
 
       var fields = [
-        { label: t('config_form.custom_fields.title'), name: "title", attrs: { type: 'title' }, icon: '*' },
-        { label: t('config_form.custom_fields.taxonomy'), name: "taxonomy", attrs: { type: 'taxonomy' }, icon: '*' },
-        { label: t('config_form.custom_fields.address'), name: "address", attrs: { type: 'address' }, icon: '*' },
-        { label: t('config_form.custom_fields.openhours'), name: "openhours", attrs: { type: 'openhours' }, icon: '⌚' },
-        { label: t('config_form.custom_fields.separator'), name: "separator", attrs: { type: 'separator' }, icon: '⚊' },
-        { label: t('config_form.custom_fields.checkbox'), name: "checkbox", attrs: { type: 'checkbox' }, icon: '☑' },
-        { label: t('config_form.custom_fields.email'), name: "email", attrs: { type: 'email' }, icon: '@' },
-        { label: t('config_form.custom_fields.images'), name: "images", attrs: { type: 'images' }, icon: '⇫' },
-        { label: t('config_form.custom_fields.files'), name: "files", attrs: { type: 'files' }, icon: '⇫' },
-        { label: t('config_form.custom_fields.elements'), name: "elements", attrs: { type: 'elements' }, icon: '*' }
+        { label: t('form_builder.fields.title'), name: "title", attrs: { type: 'title' }, icon: '*' },
+        { label: t('form_builder.fields.taxonomy'), name: "taxonomy", attrs: { type: 'taxonomy' }, icon: '*' },
+        { label: t('form_builder.fields.address'), name: "address", attrs: { type: 'address' }, icon: '*' },
+        { label: t('form_builder.fields.openhours'), name: "openhours", attrs: { type: 'openhours' }, icon: '⌚' },
+        { label: t('form_builder.fields.separator'), name: "separator", attrs: { type: 'separator' }, icon: '⚊' },
+        { label: t('form_builder.fields.checkbox'), name: "checkbox", attrs: { type: 'checkbox' }, icon: '☑' },
+        { label: t('form_builder.fields.email'), name: "email", attrs: { type: 'email' }, icon: '@' },
+        { label: t('form_builder.fields.images'), name: "images", attrs: { type: 'images' }, icon: '⇫' },
+        { label: t('form_builder.fields.files'), name: "files", attrs: { type: 'files' }, icon: '⇫' },
+        { label: t('form_builder.fields.elements'), name: "elements", attrs: { type: 'elements' }, icon: '*' }
       ];
       var templates = {
-        title: function(fieldData) { return { field: '<input id="' + fieldData.name + '"><span class="mandatory">' + t('config_form.custom_fields.title_help') + '</span>' }; },
-        address: function(fieldData) { return { field: '<input id="' + fieldData.name + '"><span class="mandatory">' + t('config_form.custom_fields.address_help') + '</span>' }; },
-        taxonomy: function(fieldData) { return { field: '<select id="' + fieldData.name + '"><option>Choisissez une catégorie principale</option></select><span class="mandatory">' + t('config_form.custom_fields.taxonomy_help') + '</span>' }; },
-        openhours: function(fieldData) { return { field: t('config_form.custom_fields.openhours_help') }; },
+        title: function(fieldData) { return { field: '<input id="' + fieldData.name + '"><span class="mandatory">' + t('form_builder.fields.title_help') + '</span>' }; },
+        address: function(fieldData) { return { field: '<input id="' + fieldData.name + '"><span class="mandatory">' + t('form_builder.fields.address_help') + '</span>' }; },
+        taxonomy: function(fieldData) { return { field: '<select id="' + fieldData.name + '"><option>Choisissez une catégorie principale</option></select><span class="mandatory">' + t('form_builder.fields.taxonomy_help') + '</span>' }; },
+        openhours: function(fieldData) { return { field: t('form_builder.fields.openhours_help') }; },
         separator: function(fieldData) { return { field: '<hr>' }; },
         checkbox: function(fieldData) { return { field: '<input id="' + fieldData.name + '"' + (fieldData.defaultvalue == "yes" ? 'checked="checked"' : '') + ' type="checkbox"/>' }; },
-        email: function(fieldData) { return { field: '<input id="' + fieldData.name + '"' + ' type="email"/><span class="mandatory">' + t('config_form.custom_fields.email_help') + '</span>' }; },
+        email: function(fieldData) { return { field: '<input id="' + fieldData.name + '"' + ' type="email"/><span class="mandatory">' + t('form_builder.fields.email_help') + '</span>' }; },
         images: function(fieldData) { return { field: '<input id="' + fieldData.name + '"' + ' type="file" accept="images/*"/>' }; },
         files: function(fieldData) { return { field: '<input id="' + fieldData.name + '"' + ' type="file" accept="'+fieldData.accept+'"/>' }; },
         image: function(fieldData) { return { field: '<input id="' + fieldData.name + '"' + ' type="text"/>' }; },
         elements: function(fieldData) { return { field: '<select id="' + fieldData.name + '"><option>'+ fieldData.label+'</option></select>' }; },
       };
 
-      var iconAttr = { label: t('config_form.icon'), placeholder: t('config_form.icon_placeholder') }
-      var labelAttr = { label: t('config_form.label') }
-      var errorMsgAttrs = { label: t('config_form.errorMsg'), placeholder: t('config_form.errorMsg_placeholder') }
-      var searchAttrs = { label: t('config_form.search'), type: 'checkbox' };
-      var searchWeightAttrs = { label: t('config_form.searchWeigh'), type: 'number', value: "1" };
-      var patternAttrs = { label: t('config_form.pattern'), placeholder: t('config_form.pattern_placeholder') };
+      var iconAttr = { label: t('form_builder.icon'), placeholder: t('form_builder.icon_placeholder') }
+      var labelAttr = { label: t('form_builder.label') }
+      var errorMsgAttrs = { label: t('form_builder.errorMsg'), placeholder: t('form_builder.errorMsg_placeholder') }
+      var searchAttrs = { label: t('form_builder.search'), type: 'checkbox' };
+      var searchWeightAttrs = { label: t('form_builder.searchWeigh'), type: 'number', value: "1" };
+      var patternAttrs = { label: t('form_builder.pattern'), placeholder: t('form_builder.pattern_placeholder') };
       var typeUserAttrs = {
         text: {
           icon: iconAttr,
           label: labelAttr,
           separator: { label: '' }, // separate important attrs from others
           subtype: { label: 'Type', options: {
-              'text': t('config_form.subtype.text'),
-              'tel': t('config_form.subtype.tel'),
-              'email': t('config_form.subtype.email'),
-              'url': t('config_form.subtype.url')
+              'text': t('form_builder.subtype.text'),
+              'tel': t('form_builder.subtype.tel'),
+              'email': t('form_builder.subtype.email'),
+              'url': t('form_builder.subtype.url')
             },
           },
           search: searchAttrs,
@@ -67,8 +67,8 @@
           icon: iconAttr,
           label: labelAttr,
           subtype: { label: 'Type', options: {
-              'textarea': t('config_form.subtype.textarea'),
-              'wysiwyg': t('config_form.subtype.wysiwyg')
+              'textarea': t('form_builder.subtype.textarea'),
+              'wysiwyg': t('form_builder.subtype.wysiwyg')
             },
           },
           search: searchAttrs,
@@ -78,7 +78,7 @@
         },
         paragraph: { 
           label: {
-            label: t('config_form.content'),
+            label: t('form_builder.content'),
             type: "textarea"
           }
         },
@@ -87,7 +87,7 @@
         number: { icon: iconAttr, label: labelAttr, errorMsg: errorMsgAttrs },
         title: {
           label: labelAttr,
-          maxlength: { label: t('config_form.maxlength')},
+          maxlength: { label: t('form_builder.maxlength')},
           icon: iconAttr,
           search: searchAttrs,
           searchWeight: searchWeightAttrs,
@@ -97,8 +97,8 @@
         address: { icon: iconAttr, label: labelAttr },
         'checkbox-group': {
           style: { 
-            label: t('config_form.style'),
-            options: { 'normal': t('config_form.options.normal'), 'filled': t('config_form.options.filled') }
+            label: t('form_builder.style'),
+            options: { 'normal': t('form_builder.options.normal'), 'filled': t('form_builder.options.filled') }
           }, 
           errorMsg: errorMsgAttrs, 
           label: labelAttr
@@ -106,8 +106,8 @@
         checkbox: {
           label: labelAttr,
           defaultvalue: { 
-            label: t('config_form.defaultvalue'),
-            options: { 'no': t('config_form.options.no'), 'yes': t('config_form.options.yes') }
+            label: t('form_builder.defaultvalue'),
+            options: { 'no': t('form_builder.options.no'), 'yes': t('form_builder.options.yes') }
           },
           errorMsg: errorMsgAttrs
         },
@@ -131,20 +131,20 @@
         files: {
           icon: iconAttr,
           label: labelAttr,
-          accept: { label: t('config_form.accept'), placeholder: t('config_form.accept_placeholder')},
+          accept: { label: t('form_builder.accept'), placeholder: t('form_builder.accept_placeholder')},
           separator: { label: '' }, // separate important attrs from others
         },
         date: {
           icon: iconAttr,
           label: labelAttr,
-          timepicker: { label: t('config_form.timepicker'), type: 'checkbox'},
-          range: { label: t('config_form.range'), type: 'checkbox' },
+          timepicker: { label: t('form_builder.timepicker'), type: 'checkbox'},
+          range: { label: t('form_builder.range'), type: 'checkbox' },
         },
         elements: {
           label: labelAttr,
           icon: iconAttr,
-          reversedBy: { label: t('config_form.reversedBy'), placeholder: t('config_form.reversedBy_placeholder') },
-          multiple: { label: t('config_form.multiple'), type: 'checkbox' },
+          reversedBy: { label: t('form_builder.reversedBy'), placeholder: t('form_builder.reversedBy_placeholder') },
+          multiple: { label: t('form_builder.multiple'), type: 'checkbox' },
           separator: { label: '' }, // separate important attrs from others
         }
       };
@@ -162,7 +162,7 @@
         controlOrder: ['text', 'email', 'images', 'textarea', 'checkbox', 'checkbox-group', 'radio-group', 'select', 'date', 'number', 'files', 'elements'],
         disabledAttrs: ['className', 'inline', 'toggle', 'description', 'other', 'multiple'],
         formData: {{ formData|json_encode|raw }},
-        roles: { 1: t('config_form.roles.1') },
+        roles: { 1: t('form_builder.roles.1') },
         typeUserAttrs: typeUserAttrs
       });
 
@@ -213,7 +213,7 @@
           })
         }
         propNameOptions = propNameOptions.sort((a,b) => a.disabled ? 1 : -1)
-        propNameOptions.unshift({id: '', text: t('config_form.propNameOptions'), disabled: true})
+        propNameOptions.unshift({id: '', text: t('form_builder.propNameOptions'), disabled: true})
         $(".fld-name:visible:not(.initialized)").select2({
           createSearchChoice:function(term, data) {
               if ($(data).filter(function() {
@@ -234,9 +234,9 @@
         $('#{{ form.vars.id }}').val(JSON.stringify(formBuilder.actions.getData()));
 
         // Changes icons and icones helpers
-        $('a[type=remove].icon-cancel').attr('title', t('config_form.remove_icon')).removeClass('icon-cancel').addClass('fa fa-trash-alt');
-        $('a[type=copy].icon-copy').attr('title', t('config_form.copy_icon'));
-        $('a[type=edit].icon-pencil').attr('title', t('config_form.edit_icon'));
+        $('a[type=remove].icon-cancel').attr('title', t('form_builder.remove_icon')).removeClass('icon-cancel').addClass('fa fa-trash-alt');
+        $('a[type=copy].icon-copy').attr('title', t('form_builder.copy_icon'));
+        $('a[type=edit].icon-pencil').attr('title', t('form_builder.edit_icon'));
 
         $('.email-field input[name=name]').val('email');
         $('.images-field input[name=name]').val('images');
diff --git a/translations/javascripts-translations.fr.yaml b/translations/javascripts-translations.fr.yaml
index c4f85fe73..bb6188429 100644
--- a/translations/javascripts-translations.fr.yaml
+++ b/translations/javascripts-translations.fr.yaml
@@ -2,7 +2,7 @@ element_form:
   geocoded_marker_text: Déplacez moi pour préciser la position</br>(au centre du bâtiment)
   geocode_error: Erreur lors de la géolocalisation de "{address}"
 
-config_form: #templates/admin/core_custom/custom-fields/form-builder.html.twig
+form_builder: #templates/admin/core_custom/custom-fields/form-builder.html.twig
   icon: 'Icône'
   icon_placeholder: "Choisissez une icône"
   remove_icon: "Supprimer"
@@ -41,7 +41,7 @@ config_form: #templates/admin/core_custom/custom-fields/form-builder.html.twig
     filled: "Plein"
     no: "Non cochée"
     yes: "Cochée"
-  custom_fields: 
+  fields: 
     title: "Titre de la fiche (obligatoire)"
     title_help: "Ce champ est indispensable"
     taxonomy: "Catégories (obligatoire)"
-- 
GitLab