collection translation is happening for collections of symbols
This commit is contained in:
parent
cdffc86984
commit
f8d675c71d
|
@ -382,6 +382,11 @@ SimpleForm uses all power of I18n API to lookup labels, hints and placeholders.
|
|||
user:
|
||||
username: 'Your username'
|
||||
password: '****'
|
||||
options:
|
||||
user:
|
||||
gender:
|
||||
male: 'Male'
|
||||
female: "Female'
|
||||
|
||||
And your forms will use this information to render the components for you.
|
||||
|
||||
|
@ -410,6 +415,10 @@ This way SimpleForm will figure out the right translation for you, based on the
|
|||
placeholders:
|
||||
username: 'Your username'
|
||||
password: '****'
|
||||
options:
|
||||
gender:
|
||||
male: 'Male'
|
||||
female: "Female'
|
||||
|
||||
SimpleForm will always look for a default attribute translation if no specific is found inside the model key. In addition, SimpleForm will fallback to default human_attribute_name from Rails when no other translation is found for labels.
|
||||
|
||||
|
|
|
@ -55,18 +55,16 @@ module SimpleForm
|
|||
value ||= common_method_for[:value]
|
||||
end
|
||||
|
||||
if SimpleForm.translate && [label, value] == [:to_s, :to_s]
|
||||
translate_collection
|
||||
[:first, :last]
|
||||
else
|
||||
[label, value]
|
||||
end
|
||||
[label, value]
|
||||
end
|
||||
|
||||
def detect_common_display_methods
|
||||
collection_classes = detect_collection_classes
|
||||
|
||||
if collection_classes.include?(Array)
|
||||
if SimpleForm.translate && collection_classes == [Symbol]
|
||||
translate_collection
|
||||
{ :label => :first, :value => :last }
|
||||
elsif collection_classes.include?(Array)
|
||||
{ :label => :first, :value => :last }
|
||||
elsif collection_includes_basic_objects?(collection_classes)
|
||||
{ :label => :to_s, :value => :to_s }
|
||||
|
|
Loading…
Reference in New Issue