1

This is my code:

<%= simple_form_for [:backend, @department] do |f| %>
  <%= f.input :parentid, input_html: { class: 'form-control' } %>
  <%= f.input :name, input_html: { class: 'form-control' }  %>
  <%= f.button :submit %>
<% end %>

This is my form and I want to change the submit text, now the text is create department, so I tried:

zh-CN:
  simple_form:
    helpers:
      submit:
        department:
          create: "新建部门"
          update: "保存编辑"

but nothing changed. How can I change it?

bruce wayne
  • 61
  • 1
  • 7

3 Answers3

5

I add a gem i18n-debug, then I restart server and flash the page. Look the terminal log , I know what is the problem。 enter image description here so, after zh-CN is helpers, not simple_form

bruce wayne
  • 61
  • 1
  • 7
0

Bruce Wayne give excellent answer. But I'v got error in i18n-debug:

private method `prepend' called for I18n::Backend::Simple:Class (NoMethodError)

on debug.rb

I changed

Backend::Simple.prepend(Debug::Hook)

on

Backend::Simple.send :prepend, Debug::Hook

and it works fine!

Or you can use patched gem in your Gemfile:

gem 'i18n-debug', github: 'robotex82/i18n-debug', branch: 'robotex82-patch-1'

from https://github.com/robotex82/i18n-debug/tree/robotex82-patch-1

Dmitry Ukolov
  • 658
  • 7
  • 10
0

i18n_debug_page provides a UI for i18n debug info, it looks like as below:

enter image description here

Yang
  • 389
  • 2
  • 15