diff --git a/app/components/editable_champ/drop_down_other_input_component/drop_down_other_input_component.html.haml b/app/components/editable_champ/drop_down_other_input_component/drop_down_other_input_component.html.haml index 609e236d2..67987679c 100644 --- a/app/components/editable_champ/drop_down_other_input_component/drop_down_other_input_component.html.haml +++ b/app/components/editable_champ/drop_down_other_input_component/drop_down_other_input_component.html.haml @@ -1,5 +1,5 @@ .drop_down_other.fr-mt-2w .fr-input-group - %label.fr-label{ for: dom_id(@champ, :value_other) } Veuillez saisir votre autre choix - + %label.fr-label{ for: dom_id(@champ, :value_other) } + = t('shared.champs.drop_down_list.other_label') = @form.text_field :value_other, maxlength: 200, size: nil, id: dom_id(@champ, :value_other), class: 'fr-input' diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index f2a6e6cc6..2e98b95ae 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -134,7 +134,7 @@ ignore_unused: ## Ignore these keys completely: ignore: -- 'shared.champs.drop_down_list{,.other}' # pluralization "other" false positive +- 'shared.champs.drop_down_list{,.other,.other_label}' # pluralization "other" false positive ## Sometimes, it isn't possible for i18n-tasks to match the key correctly, ## e.g. in case of a relative key defined in a helper method. diff --git a/config/locales/shared.en.yml b/config/locales/shared.en.yml index 2fb779193..044deec35 100644 --- a/config/locales/shared.en.yml +++ b/config/locales/shared.en.yml @@ -53,4 +53,5 @@ en: data_fetched: "Data concerning %{sources} linked to the INE %{ine} has been received from the MESRI." data_fetched_title: "Data received from the MESRI" drop_down_list: - other: Other + other: Enter another option + other_label: Enter your option diff --git a/config/locales/shared.fr.yml b/config/locales/shared.fr.yml index c510bd870..fbca54f2d 100644 --- a/config/locales/shared.fr.yml +++ b/config/locales/shared.fr.yml @@ -55,4 +55,5 @@ fr: data_fetched: "Des données concernant %{sources} liées à l’INE %{ine} ont été reçues depuis le MESRI." data_fetched_title: "Données obtenues du MESRI" drop_down_list: - other: Autre + other: Entrer une autre option + other_label: Saisir votre option diff --git a/spec/models/logic/champ_value_spec.rb b/spec/models/logic/champ_value_spec.rb index 7d57a3524..1659d129e 100644 --- a/spec/models/logic/champ_value_spec.rb +++ b/spec/models/logic/champ_value_spec.rb @@ -77,7 +77,7 @@ describe Logic::ChampValue do let(:drop_down_other) { true } it { is_expected.to eq('val1') } - it { expect(champ_value(champ.stable_id).options([champ.type_de_champ])).to match_array([["val1", "val1"], ["val2", "val2"], ["val3", "val3"], ["Autre", "__other__"]]) } + it { expect(champ_value(champ.stable_id).options([champ.type_de_champ])).to match_array([["val1", "val1"], ["val2", "val2"], ["val3", "val3"], [I18n.t('shared.champs.drop_down_list.other'), "__other__"]]) } context 'with other filled' do let(:other) { true } diff --git a/spec/system/users/dropdown_spec.rb b/spec/system/users/dropdown_spec.rb index b88caab5f..aaed8c34a 100644 --- a/spec/system/users/dropdown_spec.rb +++ b/spec/system/users/dropdown_spec.rb @@ -25,15 +25,15 @@ describe 'dropdown list with other option activated', js: true do scenario 'Select other option and the other input hidden must appear' do fill_individual - choose "Autre" + choose I18n.t('shared.champs.drop_down_list.other') expect(page).to have_selector('.drop_down_other', visible: true) end scenario "Getting back from other save the new option" do fill_individual - choose "Autre" - fill_in("Veuillez saisir votre autre choix", with: "My choice") + choose I18n.t('shared.champs.drop_down_list.other') + fill_in(I18n.t('shared.champs.drop_down_list.other_label'), with: "My choice") wait_until { user_dossier.champs_public.first.value == "My choice" } expect(user_dossier.champs_public.first.value).to eq("My choice") @@ -62,7 +62,7 @@ describe 'dropdown list with other option activated', js: true do fill_individual expect(page).not_to have_selector(".drop_down_other input") - select("Autre") + select(I18n.t('shared.champs.drop_down_list.other')) find(".drop_down_other input", visible: true) select("Secondary 1.2")