bootstrap_form
bootstrap_form copied to clipboard
Support "^ validation error text" format
Hi.
Russian is a fairly complex language, and russian rails community adopted a hack to achieve human readable complex validation messages. The thing is to drop attribute name and wrote custom validations text for required attribute with ^
at the beginning, for example:
ru:
activerecord:
errors:
models:
person:
attributes:
password:
too_long: "^Ваш пароль слишком длинный, максимум: %{count} символов"
Popular gem for handle russian locale also supports it
But this hack lead to wrong help-text form invalid input:
Will you accept pull request with fix?
This is completely outside my area of expertise, but it seems reasonable to me. I would accept a PR, as long as this behavior can be opt-in. In other words, normally this behavior is not enabled, but a developer can enable it by doing something like
require "bootstrap_form/russian_ext"
in their app (e.g. in a Rails initializer).