国际化配置simple_form

en:
  simple_form:
    labels:
      defaults:
        pasword: 'default_password'
      aad:
        username: 'User  name'
        pasword: 'Password'
        edit:
          username: 'Change user name'
          pasword: 'Change password'

    hints:
      aad:
        username: 'Your username'
        pasword: '****'

    placeholders:
      aad:
        username: 'User name to sign in.'
        pasword: 'No special characters, please.'
    include_blanks:
      aad:
        age: 'Rather not to say'
    prompts:
      aad:
        role: 'Select your role'
    required:
      text: 'required'
      mark: '*'
    error_notification:
      default_message: "Please review the problems below:"
View Code

/home/pinmi/Godproject/config/locales/simple_form.en.yml

en:
  simple_form:
    labels:
      defaults:
        pasword: 'default_password'
      aad:
        username: 'User  name'
        pasword: 'Password'
        edit:
          username: 'Change user name'
          pasword: 'Change password'
    options:
      username:
        admin: 'Administrator'
        editor: 'Editor'
    hints:
      email:
        username: 'Your username'
        pasword: '****'

    placeholders:
      aad:
        username: 'User name to sign in.'
        pasword: 'No special characters, please.'
    include_blanks:
      aad:
        age: 'Rather not to say'
    prompts:
      aad:
        role: 'Select your role'
    required:
      text: 'required'
      mark: '*'
    error_notification:
      default_message: "Please review the problems below:"
View Code

https://github.com/miaomiaotab/simple_form  所有内容

https://github.com/plataformatec/simple_form/wiki/Custom-inputs-examples  

 /home/pinmi/Godproject/app/inputs/collection_select_input.rb下面可用的函数例子

http://www.rubydoc.info/github/plataformatec/simple_form/master/frames

2种自定义:

1.app下面新建inputs文件夹,新建aa_input.rb文件,在_form.html.erb中,.input组件后可以用as: :aa直接引用

  app/inputs/collection_select_input.rb

2.config/locales/simple_form.en.yml下对标签,lookup进行修改

原文地址:https://www.cnblogs.com/tabCtrlShift/p/6109763.html