From 9f715e84d51ae4334665d040befda6a20be3c30a Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Fri, 15 Mar 2024 18:20:38 +0100 Subject: [PATCH] add i18n for export template --- .../export_templates/_form.html.haml | 17 ++++++++++++----- config/locales/models/export_templates/en.yml | 17 +++++++++++++++++ config/locales/models/export_templates/fr.yml | 17 +++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 config/locales/models/export_templates/en.yml create mode 100644 config/locales/models/export_templates/fr.yml diff --git a/app/views/instructeurs/export_templates/_form.html.haml b/app/views/instructeurs/export_templates/_form.html.haml index 057120f28..b0f7676fd 100644 --- a/app/views/instructeurs/export_templates/_form.html.haml +++ b/app/views/instructeurs/export_templates/_form.html.haml @@ -1,9 +1,7 @@ .fr-grid-row.fr-grid-row--gutters .fr-col-12.fr-col-md-8 = form_with url: form_url, model: @export_template, local: true do |f| - = render Dsfr::InputComponent.new(form: f, attribute: :name, input_type: :text_field) do |c| - - c.with_hint do - Indiquez le nom à utiliser pour ce modèle d'export + = render Dsfr::InputComponent.new(form: f, attribute: :name, input_type: :text_field) - if groupe_instructeurs.many? .fr-input-group @@ -19,13 +17,22 @@ = f.hidden_field :kind .fr-input-group{ data: { controller: 'tiptap' } } - = f.label :tiptap_default_dossier_directory, class: "fr-label" + = f.label :tiptap_default_dossier_directory, class: "fr-label" do + = f.object.class.human_attribute_name(:tiptap_default_dossier_directory) + = render EditableChamp::AsteriskMandatoryComponent.new + %span.fr-hint-text + = t('activerecord.attributes.export_template.hints.tiptap_default_dossier_directory') + .tiptap-editor.fr-mt-1w{ data: { tiptap_target: 'editor' } } = f.hidden_field :tiptap_default_dossier_directory, data: { tiptap_target: 'input', controller: 'turbo-input', turbo_input_url_value: preview_instructeur_export_templates_path } .fr-mt-2w= render TagsButtonListComponent.new(tags: { nil => @export_template.specific_tags }) .fr-input-group{ data: { controller: 'tiptap' } } - = f.label :tiptap_pdf_name, class: "fr-label" + = f.label :tiptap_pdf_name, class: "fr-label" do + = f.object.class.human_attribute_name(:tiptap_pdf_name) + = render EditableChamp::AsteriskMandatoryComponent.new + %span.fr-hint-text + = t('activerecord.attributes.export_template.hints.tiptap_pdf_name') .tiptap-editor.fr-mt-1w{ data: { tiptap_target: 'editor' } } = f.hidden_field :tiptap_pdf_name, data: { tiptap_target: 'input', controller: 'turbo-input', turbo_input_url_value: preview_instructeur_export_templates_path } .fr-mt-2w= render TagsButtonListComponent.new(tags: { nil => @export_template.specific_tags }) diff --git a/config/locales/models/export_templates/en.yml b/config/locales/models/export_templates/en.yml new file mode 100644 index 000000000..e6cd08856 --- /dev/null +++ b/config/locales/models/export_templates/en.yml @@ -0,0 +1,17 @@ +en: + activerecord: + models: + export_template: Export template + attributes: + export_template: + hints: + name: "The name will be visible by you and the other instructors" + tiptap_default_dossier_directory: "How would you like to name the directory containing the documents of a folder?" + tiptap_pdf_name: "How would you like to name the pdf file containing all the user's answers?" + name: "Template's name" + tiptap_default_dossier_directory: "Directory's name for pdf format" + tiptap_pdf_name: "Export's filename" + errors: + models: + export_template: + dossier_number_mandatory: "must contain dossier's number" diff --git a/config/locales/models/export_templates/fr.yml b/config/locales/models/export_templates/fr.yml new file mode 100644 index 000000000..60852aee0 --- /dev/null +++ b/config/locales/models/export_templates/fr.yml @@ -0,0 +1,17 @@ +fr: + activerecord: + models: + export_template: "Modèle d'export" + attributes: + export_template: + hints: + name: "Le nom sera visible par vous et les autres instructeurs pour générer un export" + tiptap_default_dossier_directory: "Comment souhaitez-vous nommer le répertoire contenant les documents d'un dossier ?" + tiptap_pdf_name: "Comment souhaitez-vous nommer le fichier pdf qui contient toutes les réponses de l'usager ?" + name: "Nom du modèle" + tiptap_default_dossier_directory: Nom du répertoire + tiptap_pdf_name: "Nom du dossier au format pdf" + errors: + models: + export_template: + dossier_number_mandatory: doit contenir le numéro du dossier