bootstrap_form icon indicating copy to clipboard operation
bootstrap_form copied to clipboard

Support "^ validation error text" format

Open Zmokizmoghi opened this issue 6 years ago • 1 comments

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:

image

Will you accept pull request with fix?

Zmokizmoghi avatar Mar 06 '18 12:03 Zmokizmoghi

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).

mattbrictson avatar Mar 07 '18 16:03 mattbrictson