You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exactly what I was looking for, but I am kind of confused as to how to use it. When you have a validation message like this you can't just directly pass options from ValidationMessage into interpolate_message.
validation=%AbsintheErrorPayload.ValidationMessage{field: "headline",key: "headline",code: :max,options: [%{value: "255",key: :count},%{value: "string",key: :type},%{value: "max",key: :kind}],template: "should be at most %{count} character(s)",message: "should be at most 255 character(s)"}ChangesetParser.interpolate_message({validation.template,validation.options})
Also you get the template but it isn't the translated template so you'd need to do something like this currently
validation=Enum.into(error.options,[],&{&1[:key],&1[:value]})# => [count: "255", type: "string", kind: "max"]# Then translate the templatetemplate=Gettext.dgettext(MyApp.Gettext,"errors",error.template)# Finally interpolatemessage=ChangesetParser.interpolate_message({template,options})
It there a way to translate error messages with Gettext? I guess relevant function is
AbsintheErrorPayload.ChangesetParser.interpolate_message
The text was updated successfully, but these errors were encountered: