Merge pull request #6477 from betagouv/more-i18n-lint

i18n : ajout de nouveaux tests automatisés (#6477)
This commit is contained in:
Pierre de La Morinerie 2021-09-21 10:58:16 -05:00 committed by GitHub
commit 61642f834f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 150 additions and 186 deletions

View file

@ -3,22 +3,22 @@ class Helpscout::FormAdapter
def self.options
[
[I18n.t(TYPE_INFO, scope: [:support, :question]), TYPE_INFO, FAQ_CONTACTER_SERVICE_EN_CHARGE_URL],
[I18n.t(TYPE_PERDU, scope: [:support, :question]), TYPE_PERDU, LISTE_DES_DEMARCHES_URL],
[I18n.t(TYPE_INSTRUCTION, scope: [:support, :question]), TYPE_INSTRUCTION, FAQ_OU_EN_EST_MON_DOSSIER_URL],
[I18n.t(TYPE_AMELIORATION, scope: [:support, :question]), TYPE_AMELIORATION, FEATURE_UPVOTE_URL],
[I18n.t(TYPE_AUTRE, scope: [:support, :question]), TYPE_AUTRE]
[I18n.t(:question, scope: [:support, :index, TYPE_INFO]), TYPE_INFO, FAQ_CONTACTER_SERVICE_EN_CHARGE_URL],
[I18n.t(:question, scope: [:support, :index, TYPE_PERDU]), TYPE_PERDU, LISTE_DES_DEMARCHES_URL],
[I18n.t(:question, scope: [:support, :index, TYPE_INSTRUCTION]), TYPE_INSTRUCTION, FAQ_OU_EN_EST_MON_DOSSIER_URL],
[I18n.t(:question, scope: [:support, :index, TYPE_AMELIORATION]), TYPE_AMELIORATION, FEATURE_UPVOTE_URL],
[I18n.t(:question, scope: [:support, :index, TYPE_AUTRE]), TYPE_AUTRE]
]
end
def self.admin_options
[
[I18n.t(ADMIN_TYPE_QUESTION, scope: [:supportadmin], app_name: APPLICATION_NAME), ADMIN_TYPE_QUESTION],
[I18n.t(ADMIN_TYPE_RDV, scope: [:supportadmin], app_name: APPLICATION_NAME), ADMIN_TYPE_RDV],
[I18n.t(ADMIN_TYPE_SOUCIS, scope: [:supportadmin], app_name: APPLICATION_NAME), ADMIN_TYPE_SOUCIS],
[I18n.t(ADMIN_TYPE_PRODUIT, scope: [:supportadmin]), ADMIN_TYPE_PRODUIT],
[I18n.t(ADMIN_TYPE_DEMANDE_COMPTE, scope: [:supportadmin]), ADMIN_TYPE_DEMANDE_COMPTE],
[I18n.t(ADMIN_TYPE_AUTRE, scope: [:supportadmin]), ADMIN_TYPE_AUTRE]
[I18n.t(:question, scope: [:support, :admin, ADMIN_TYPE_QUESTION], app_name: APPLICATION_NAME), ADMIN_TYPE_QUESTION],
[I18n.t(:question, scope: [:support, :admin, ADMIN_TYPE_RDV], app_name: APPLICATION_NAME), ADMIN_TYPE_RDV],
[I18n.t(:question, scope: [:support, :admin, ADMIN_TYPE_SOUCIS], app_name: APPLICATION_NAME), ADMIN_TYPE_SOUCIS],
[I18n.t(:question, scope: [:support, :admin, ADMIN_TYPE_PRODUIT]), ADMIN_TYPE_PRODUIT],
[I18n.t(:question, scope: [:support, :admin, ADMIN_TYPE_DEMANDE_COMPTE]), ADMIN_TYPE_DEMANDE_COMPTE],
[I18n.t(:question, scope: [:support, :admin, ADMIN_TYPE_AUTRE]), ADMIN_TYPE_AUTRE]
]
end

View file

@ -170,6 +170,8 @@ class DossierMailer < ApplicationMailer
# This is an override of `default_i18n_subject` method
# https://api.rubyonrails.org/v5.0.0/classes/ActionMailer/Base.html#method-i-default_i18n_subject
#
# i18n-tasks-use t("dossier_mailer.#{action}.subject")
def default_i18n_subject(interpolations = {})
if interpolations[:state]
mailer_scope = self.class.mailer_name.tr('/', '.')

View file

@ -3,10 +3,10 @@
#contact-form
.container
%h1.new-h1
= t('contact_team', scope: [:supportadmin])
= t('.contact_team')
.description
= t('admin_intro_html', scope: [:supportadmin], contact_path: contact_path)
= t('.admin_intro_html', contact_path: contact_path)
%br
%p.mandatory-explanation= t('asterisk_html', scope: [:utils])
@ -14,19 +14,19 @@
- if !user_signed_in?
.contact-champ
= label_tag :email do
= t('pro_mail', scope: [:supportadmin])
= t('.pro_mail')
%span.mandatory *
= text_field_tag :email, params[:email], required: true
.contact-champ
= label_tag :type do
= t('your_question', scope: [:support, :question])
= t('.your_question')
%span.mandatory *
= select_tag :type, options_for_select(@options, params[:type])
.contact-champ
= label_tag :phone do
= t('pro_phone_number', scope: [:supportadmin])
= t('.pro_phone_number')
= text_field_tag :phone
.contact-champ

View file

@ -1,16 +1,16 @@
- content_for(:title, 'Contact')
- content_for(:title, t('.contact'))
- content_for :footer do
= render partial: "root/footer"
#contact-form
.container
%h1.new-h1
= t('contact', scope: [:support])
= t('.contact')
= form_tag contact_path, method: :post, multipart: true, class: 'form' do |f|
.description
%p= t('intro_html', scope: [:support])
%p= t('.intro_html')
%br
%p.mandatory-explanation= t('asterisk_html', scope: [:utils])
@ -23,7 +23,7 @@
.contact-champ
= label_tag :type do
= t('your_question', scope: [:support, :question])
= t('.your_question')
%span.mandatory *
= hidden_field_tag :type, params[:type]
%dl
@ -37,9 +37,10 @@
%dd
.support.card.featured.hidden{ id: question_type }
.card-title
= t('our_answer', scope: [:support, :response])
= t('.our_answer')
.card-content
= t("#{question_type}_html", scope: [:support, :response], base_url: APPLICATION_BASE_URL, "link_#{question_type}": link)
-# i18n-tasks-use t("support.index.#{question_type}.answer_html")
= t('answer_html', scope: [:support, :index, question_type], base_url: APPLICATION_BASE_URL, "link_#{question_type}": link)
.contact-champ
= label_tag :dossier_id, t('file_number', scope: [:utils])
@ -61,9 +62,9 @@
= label_tag :piece_jointe do
= t('pj', scope: [:utils])
%p.notice.hidden{ data: { 'contact-type-only': Helpscout::FormAdapter::TYPE_AMELIORATION } }
= t('notice_pj_product', scope: [:support, :response])
= t('.notice_pj_product')
%p.notice.hidden{ data: { 'contact-type-only': Helpscout::FormAdapter::TYPE_AUTRE } }
= t('notice_pj_other', scope: [:support, :response])
= t('.notice_pj_other')
= file_field_tag :piece_jointe
= hidden_field_tag :tags, @tags&.join(',')

View file

@ -17,13 +17,11 @@
&nbsp;?
.email-suggestion-answer
= button_tag type: 'button', class: 'button small', onclick: "DS.acceptEmailSuggestion()" do
= t('simple_form.yes')
= t('utils.yes')
= button_tag type: 'button', class: 'button small', onclick: "DS.discardEmailSuggestionBox()" do
= t('simple_form.no')
= t('utils.no')
= f.label :password, t('views.registrations.new.password_label', min_length: PASSWORD_MIN_LENGTH), id: :user_password_label
= f.password_field :password, autocomplete: 'new-password', value: @user.password, placeholder: t('views.registrations.new.password_placeholder', min_length: PASSWORD_MIN_LENGTH), 'aria-describedby': :user_password_label
= f.submit t('views.shared.account.create'), class: "button large primary expand"

View file

@ -96,6 +96,7 @@ search:
## Consider these keys used:
ignore_unused:
- 'activerecord.models.*'
- 'activerecord.attributes.*'
- 'activerecord.errors.*'
- 'errors.messages.blank'

View file

@ -32,6 +32,8 @@
en:
help: 'Help'
utils:
'yes': Yes
'no': No
deconnexion: "Log out"
pj: "Attachments"
asterisk_html: Fields marked by an asterisk ( <span class = mandatory>*</span> ) are mandatory.
@ -184,7 +186,6 @@ en:
status: "Status"
updated: "Updated"
actions: "Actions"
accessibility_question: "What do you think about the accessibility of this service?"
dossier_action:
edit_dossier: "Edit the file"
start_other_dossier: "Start an other file"

View file

@ -22,6 +22,8 @@
fr:
help: 'Aide'
utils:
'yes': Oui
'no': Non
deconnexion: "Déconnexion"
pj: "Pièces jointes"
asterisk_html: Les champs suivis dun astérisque ( <span class = mandatory> * </span> ) sont obligatoires.
@ -180,7 +182,6 @@ fr:
status: "Statut"
updated: "Mis à jour"
actions: "Actions"
accessibility_question: "Que pensez-vous de la facilité dutilisation de ce service ?"
dossier_action:
edit_dossier: "Modifier le dossier"
start_other_dossier: "Commencer un autre dossier"

View file

@ -1,31 +0,0 @@
en:
simple_form:
"yes": 'Yes'
"no": 'No'
required:
text: 'required'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark wont be used.
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Please review the problems below:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'

View file

@ -1,31 +0,0 @@
fr:
simple_form:
"yes": 'Oui'
"no": 'Non'
required:
text: 'obligatoire'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Erreur, veuillez vérifier vos réponses:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'

View file

@ -3,7 +3,7 @@ fr:
notify_new_answer:
subject: Nouveau message pour votre dossier nº %{dossier_id} « %{libelle_demarche} »
body_html: |
Vous avez reçu un <b>nouveau message</b> de la part du service en charge de votre dossier.
Vous avez reçu un <b>nouveau message</b> de la part du service en charge de votre dossier sur la démarche « %{libelle_demarche} ».
link: |
Pour consulter le message et y répondre, cliquez sur le bouton ci-dessous :
body_draft_html: |

View file

@ -3,7 +3,7 @@ fr:
notify_revert_to_instruction:
subject: Votre dossier nº %{dossier_id} sur la démarche « %{libelle_demarche} » est en train dêtre réexaminé
body_html: |
Votre dossier va être réexaminé, la précédente décision sur ce dossier est caduque.
Votre dossier  %{dossier_id} va être réexaminé, la précédente décision sur ce dossier est caduque.
Vous pouvez retrouver le dossier que vous avez créé pour la démarche <b>« %{libelle_demarche} »</b> à l'adresse suivante :
contact: |
Pour obtenir le détail de cette modification de la décision, vous pouvez contacter par email :

View file

@ -0,0 +1,56 @@
en:
support:
index:
contact: Contact
intro_html: Contact us via this form and we will answer you as quickly as possible.<br>Make sure you provide all the required information so we can help you in the best way.
your_question: Your question
our_answer: 👉 Our answer
notice_pj_product: A screenshot can help us identify the element to improve.
notice_pj_other: A screenshot can help us identify the issue.
procedure_info:
question: I've encountered a problem while completing my application
answer_html: "<p>Are you sure that all the mandatory fields (<span class= mandatory> * </span>) are properly filled?
<p>If you have questions about the information requested, contact the service in charge of the procedure.</p>
<p><a href=%{link_procedure_info}>Find more information</a></p>"
instruction_info:
question: I have a question about the instruction of my application
answer_html: "<p>If you have questions about the instruction of your application (response delay for example), contact directly the instructor via our mail system.</p>
<p><a href=%{link_instruction_info}>Find more information</a></p>
<br>
<p>If you are facing technical issues on the website, use the form below. We will not be able to inform you about the instruction of your application.</p>"
product:
question: I have an idea to improve the website
answer_html: "<p>Got an idea? Please check our <strong>enhancement dashboard</strong></p>
<p><ul><li>Vote for your priority improvements</li>
<li>Share your own ideas</li></ul></p>
<p><strong><a href=%{link_product}>➡ Access the enhancement dashboard</a></strong></p>"
lost_user:
question: I am having trouble finding the procedure I am looking for
answer_html: "<p>We invite you to contact the administration in charge of the procedure so they can provide you the link.
It should look like this: %{base_url}/commencer/NOM_DE_LA_DEMARCHE.</p>
<br>
<p>You can find here the most popular procedures (licence, detr, etc.) :</p>
<p><a href=%{link_lost_user}>%{link_lost_user}</a></p>"
other:
question: Other topic
admin:
your_question: Your question
admin_intro_html: "<p>As an administration, you can contact us through this form. We'll answer you as quickly as possibly by e-mail or phone.</p>
<br>
<p><strong>Caution, this form is dedicated to public bodies only.</strong>
It does not concern individuals, companies nor associations (except those recognised of public utility). If you belong to one of these categories, contact us <a href=%{contact_path}>here</a>.</p>"
contact_team: Contact our team
pro_phone_number: Professional phone number (direct line)
pro_mail: Professional email address
admin question:
question: I have a question about %{app_name}
admin demande rdv:
question: I request an appointment for an online presentation of %{app_name}
admin soucis:
question: I am facing a technical issue on %{app_name}
admin suggestion produit:
question: I have a suggestion for an evolution
admin demande compte:
question: I want to open an admin account with an Orange, Wanadoo, etc. email
admin autre:
question: Other topic

View file

@ -0,0 +1,56 @@
fr:
support:
index:
contact: Contact
intro_html: Contactez-nous via ce formulaire et nous vous répondrons dans les plus brefs délais.<br>Pensez bien à nous donner le plus dinformations possible pour que nous puissions vous aider au mieux.
your_question: Votre question
our_answer: 👉 Notre réponse
notice_pj_product: Une capture décran peut nous aider à identifier plus facilement lendroit à améliorer.
notice_pj_other: Une capture décran peut nous aider à identifier plus facilement le problème.
procedure_info:
question: Jai un problème lors du remplissage de mon dossier
answer_html: "<p>Avez-vous bien vérifié que tous les champs obligatoires (<span class= mandatory> * </span>) sont remplis ?
<p>Si vous avez des questions sur les informations à saisir, contactez les services en charge de la démarche.</p>
<p><a href=%{link_procedure_info}>En savoir plus</a></p>"
instruction_info:
question: Jai une question sur linstruction de mon dossier
answer_html: "<p>Si vous avez des questions sur linstruction de votre dossier (par exemple sur les délais), nous vous invitons à contacter directement les services qui instruisent votre dossier par votre messagerie.</p>
<p><a href=%{link_instruction_info}>En savoir plus</a></p>
<br>
<p>Si vous souhaitez poser une question pour un problème technique sur le site, utilisez le formulaire ci-dessous. Nous ne pourrons pas vous renseigner sur linstruction de votre dossier.</p>"
product:
question: Jai une idée damélioration pour votre site
answer_html: "<p>Une idée ? Pensez à consulter notre <strong>tableau de bord des améliorations</strong></p>
<p><ul><li>Votez pour vos améliorations prioritaires;</li>
<li>Proposez votre propre idée.</li></ul></p>
<p><strong><a href=%{link_product}>➡ Accéder au tableau des améliorations</a></strong></p>"
lost_user:
question: Je ne trouve pas la démarche que je veux faire
answer_html: "<p>Nous vous invitons à contacter ladministration en charge de votre démarche pour quelle vous indique le lien à suivre. Celui-ci devrait ressembler à cela : %{base_url}/commencer/NOM_DE_LA_DEMARCHE.</p>
<br>
<p>Vous pouvez aussi consulter ici la liste de nos démarches les plus frequentes (permis, detr etc) :</p>
<p><a href=%{link_lost_user}>%{link_lost_user}</a></p>"
other:
question: Autre sujet
admin:
your_question: Votre question
admin_intro_html: "<p>En tant quadministration, vous pouvez nous contactez via ce formulaire. Nous vous répondrons dans les plus brefs délais, par email ou par téléphone.</p>
<br>
<p><strong>Attention, ce formulaire est réservé uniquement aux organismes publics.</strong>
Il ne concerne ni les particuliers, ni les entreprises, ni les associations (sauf celles reconnues dutilité publique). Si c'est votre cas, rendez-vous sur notre
<a href=%{contact_path}>formulaire de contact public</a>.</p>"
contact_team: Contactez notre équipe
pro_phone_number: Numéro de téléphone professionnel (ligne directe)
pro_mail: Adresse e-mail professionnelle
admin question:
question: Jai une question sur %{app_name}
admin demande rdv:
question: Demande de RDV pour une présentation à distance de %{app_name}
admin soucis:
question: Jai un problème technique avec %{app_name}
admin suggestion produit:
question: Jai une proposition dévolution
admin demande compte:
question: Je souhaite ouvrir un compte administrateur avec un email Orange, Wanadoo, etc.
admin autre:
question: Autre sujet

View file

@ -1,46 +0,0 @@
en:
support:
contact: Contact
intro_html: Contact us via this form and we will answer you as quickly as possible.<br>Make sure you provide all the required information so we can help you in the best way.
question:
your_question: Your question
choose_question: Choose your question
procedure_info: I've encountered a problem while completing my application
instruction_info: I have a question about the instruction of my application
product: I have an idea to improve the website
lost_user: I am having trouble finding the procedure I am looking for
other: Other topic
response:
our_answer: 👉 Our answer
procedure_info_html: "<p>Are you sure that all the mandatory fields (<span class= mandatory> * </span>) are properly filled?
<p>If you have questions about the information requested, contact the service in charge of the procedure.</p>
<p><a href=%{link_procedure_info}>Find more information</a></p>"
instruction_info_html: "<p>If you have questions about the instruction of your application (response delay for example), contact directly the instructor via our mail system.</p>
<p><a href=%{link_instruction_info}>Find more information</a></p>
<br>
<p>If you are facing technical issues on the website, use the form below. We will not be able to inform you about the instruction of your application.</p>"
product_html: "<p>Got an idea? Please check our <strong>enhancement dashboard</strong></p>
<p><ul><li>Vote for your priority improvements</li>
<li>Share your own ideas</li></ul></p>
<p><strong><a href=%{link_product}>➡ Access the enhancement dashboard</a></strong></p>"
lost_user_html: "<p>We invite you to contact the administration in charge of the procedure so they can provide you the link.
It should look like this: %{base_url}/commencer/NOM_DE_LA_DEMARCHE.</p>
<br>
<p>You can find here the most popular procedures (licence, detr, etc.) :</p>
<p><a href=%{link_lost_user}>%{link_lost_user}</a></p>"
notice_pj_product: A screenshot can help us identify the element to improve.
notice_pj_other: A screenshot can help us identify the issue.
supportadmin:
admin_intro_html: "<p>As an administration, you can contact us through this form. We'll answer you as quickly as possibly by e-mail or phone.</p>
<br>
<p><strong>Caution, this form is dedicated to public bodies only.</strong>
It does not concern individuals, companies nor associations (except those recognised of public utility). If you belong to one of these categories, contact us <a href=%{contact_path}>here</a>.</p>"
contact_team: Contact our team
pro_phone_number: Professional phone number (direct line)
pro_mail: Professional email address
admin demande rdv: I request an appointment for an online presentation of %{app_name}
admin question: I have a question about %{app_name}
admin soucis: I am facing a technical issue on %{app_name}
admin suggestion produit: I have a suggestion for an evolution
admin demande compte: I want to open an admin account with an Orange, Wanadoo, etc. email
admin autre: Other topic

View file

@ -1,46 +0,0 @@
fr:
support:
contact: Contact
intro_html: Contactez-nous via ce formulaire et nous vous répondrons dans les plus brefs délais.<br>Pensez bien à nous donner le plus dinformations possible pour que nous puissions vous aider au mieux.
question:
your_question: Votre question
choose_question: Choisir une question
procedure_info: Jai un problème lors du remplissage de mon dossier
instruction_info: Jai une question sur linstruction de mon dossier
product: Jai une idée damélioration pour votre site
lost_user: Je ne trouve pas la démarche que je veux faire
other: Autre sujet
response:
our_answer: 👉 Notre réponse
procedure_info_html: "<p>Avez-vous bien vérifié que tous les champs obligatoires (<span class= mandatory> * </span>) sont remplis ?
<p>Si vous avez des questions sur les informations à saisir, contactez les services en charge de la démarche.</p>
<p><a href=%{link_procedure_info}>En savoir plus</a></p>"
instruction_info_html: "<p>Si vous avez des questions sur linstruction de votre dossier (par exemple sur les délais), nous vous invitons à contacter directement les services qui instruisent votre dossier par votre messagerie.</p>
<p><a href=%{link_instruction_info}>En savoir plus</a></p>
<br>
<p>Si vous souhaitez poser une question pour un problème technique sur le site, utilisez le formulaire ci-dessous. Nous ne pourrons pas vous renseigner sur linstruction de votre dossier.</p>"
product_html: "<p>Une idée ? Pensez à consulter notre <strong>tableau de bord des améliorations</strong></p>
<p><ul><li>Votez pour vos améliorations prioritaires;</li>
<li>Proposez votre propre idée.</li></ul></p>
<p><strong><a href=%{link_product}>➡ Accéder au tableau des améliorations</a></strong></p>"
lost_user_html: "<p>Nous vous invitons à contacter ladministration en charge de votre démarche pour quelle vous indique le lien à suivre. Celui-ci devrait ressembler à cela : %{base_url}/commencer/NOM_DE_LA_DEMARCHE.</p>
<br>
<p>Vous pouvez aussi consulter ici la liste de nos démarches les plus frequentes (permis, detr etc) :</p>
<p><a href=%{link_lost_user}>%{link_lost_user}</a></p>"
notice_pj_product: Une capture décran peut nous aider à identifier plus facilement lendroit à améliorer.
notice_pj_other: Une capture décran peut nous aider à identifier plus facilement le problème.
supportadmin:
admin_intro_html: "<p>En tant quadministration, vous pouvez nous contactez via ce formulaire. Nous vous répondrons dans les plus brefs délais, par email ou par téléphone.</p>
<br>
<p><strong>Attention, ce formulaire est réservé uniquement aux organismes publics.</strong>
Il ne concerne ni les particuliers, ni les entreprises, ni les associations (sauf celles reconnues dutilité publique). Si c'est votre cas, rendez-vous sur notre
<a href=%{contact_path}>formulaire de contact public</a>.</p>"
contact_team: Contactez notre équipe
pro_phone_number: Numéro de téléphone professionnel (ligne directe)
pro_mail: Adresse e-mail professionnelle
admin demande rdv: Demande de RDV pour une présentation à distance de %{app_name}
admin question: Jai une question sur %{app_name}
admin soucis: Jai un problème technique avec %{app_name}
admin suggestion produit: Jai une proposition dévolution
admin demande compte: Je souhaite ouvrir un compte administrateur avec un email Orange, Wanadoo, etc.
admin autre: Autre sujet

View file

@ -3,6 +3,8 @@ task :lint do
sh "bundle exec haml-lint app/views/"
sh "bundle exec scss-lint app/assets/stylesheets/"
sh "bundle exec i18n-tasks missing --locales fr"
sh "bundle exec i18n-tasks unused --locale en" # TODO: check for all locales
sh "bundle exec i18n-tasks check-consistent-interpolations"
sh "bundle exec brakeman --no-pager"
sh "yarn lint:js"
end