@@ -46,8 +46,13 @@ module StructuredParams
4646 # Walk +parts+ (e.g. ["hobbies", "0", "name"]) and build a human-readable
4747 # label by delegating each segment to the appropriate nested class.
4848 #
49- # : (Array[String]) -> String
50- def resolve_nested_human_attribute_name : (Array[String]) -> String
49+ # Only +:locale+ is forwarded to inner +human_attribute_name+ calls.
50+ # Options such as +:default+ are specific to the outer call (e.g. from
51+ # +full_messages+) and must not bleed into individual segment lookups,
52+ # where they would replace the segment's own translation fallback.
53+ #
54+ # : (Array[String], Hash[untyped, untyped]) -> String
55+ def resolve_nested_human_attribute_name : (Array[String], Hash[untyped , untyped ]) -> String
5156
5257 # Convert a parts array into (index_or_nil, attr) pairs.
5358 #
@@ -64,7 +69,10 @@ module StructuredParams
6469 # activemodel.errors.nested_attribute.array (parent, index, child)
6570 # activemodel.errors.nested_attribute.object (parent, child)
6671 #
67- # : (String?, String?, String) -> String
68- def build_nested_label : (String?, String?, String) -> String
72+ # The +locale:+ key from +options+ is forwarded to ::I18n.t so that an
73+ # explicit locale passed to human_attribute_name is honoured.
74+ #
75+ # : (String?, String?, String, Hash[untyped, untyped]) -> String
76+ def build_nested_label : (String?, String?, String, Hash[untyped , untyped ]) -> String
6977 end
7078end
0 commit comments