Skip to content

Commit ac93258

Browse files
committed
i18n(referentiels): extract hardcoded strings from ReferentielPrefillComponent
1 parent 8a84daa commit ac93258

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

app/components/referentiels/referentiel_prefill_component.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ class Referentiels::ReferentielPrefillComponent < Referentiels::MappingFormBase
1717
Referentiels::MappingFormComponent::TYPES[:array] => %w[multiple_drop_down_list],
1818
}.freeze
1919

20-
PUBLIC_FIELDS_GROUP = "Champs"
21-
PRIVATE_ANNOTATIONS_GROUP = "Annotations privées"
20+
def public_fields_group
21+
t(".public_fields_group")
22+
end
23+
24+
def private_annotations_group
25+
t(".private_annotations_group")
26+
end
2227

2328
def source_tdcs
2429
@source_tdcs ||= begin
@@ -81,14 +86,14 @@ def group_tdcs_by_visibility(tdcs)
8186
end
8287

8388
def empty_groups
84-
{ PUBLIC_FIELDS_GROUP => [], PRIVATE_ANNOTATIONS_GROUP => [] }
89+
{ public_fields_group => [], private_annotations_group => [] }
8590
end
8691

8792
def visibility_group_for(tdc)
8893
if tdc.public?
89-
PUBLIC_FIELDS_GROUP
94+
public_fields_group
9095
else
91-
PRIVATE_ANNOTATIONS_GROUP
96+
private_annotations_group
9297
end
9398
end
9499

@@ -100,7 +105,7 @@ def select_grouped_tdcs(grouped_tdcs)
100105
if type_de_champ.public?
101106
grouped_tdcs.compact_blank
102107
else
103-
grouped_tdcs[PRIVATE_ANNOTATIONS_GROUP]
108+
grouped_tdcs[private_annotations_group]
104109
end
105110
end
106111

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
en:
2+
caption: "Indicate which user form fields should be prefilled with referent data"
3+
property: "Property"
4+
example_data: "Example data"
5+
data_type: "Data type"
6+
prefill_field: "User form field to prefill"
7+
confirm_reset_prefill: "Are you sure you want to reset the prefilling?"
8+
reset_prefill: "Reset prefilling"
9+
public_fields_group: "Fields"
10+
private_annotations_group: "Private annotations"

app/components/referentiels/referentiel_prefill_component/referentiel_prefill_component.fr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ fr:
66
prefill_field: "Champ du formulaire usager à préremplir"
77
confirm_reset_prefill: "Êtes-vous sûr de vouloir réinitialiser le préremplissage ?"
88
reset_prefill: "Réinitialiser le préremplissage"
9+
public_fields_group: "Champs"
10+
private_annotations_group: "Annotations privées"

0 commit comments

Comments
 (0)