i18n for buttons #847

sevenseacat opened this Issue May 10, 2012 · 4 comments


None yet
3 participants

Using Formtastic 2.2.0.

I know the readme says it should be possible to configure i18n for buttons using:

      create: 'My text'

However this simply doesn't seem to work. Neither does nesting the create key under a model name.

If I use a named key, eg create_foo and then reference it in my view f.action :submit, label: :create_foo it works, but no other method seems to.


mjonuschat commented May 10, 2012

Did you enable enhanced I18n lookups in the initializer?

Formtastic::FormBuilder.i18n_lookups_by_default = true



justinfrench commented May 11, 2012

There's some test coverage around this in spec/actions/generic_action_spec.rb

This namespace seems right:


Inside there, these are the keys we're referencing:

  • if it's form for an object AND the object responds to either persisted? or new_record?
    • use update if it's persisted?
    • otherwise use create
  • otherwise use the method (submit in your example, but there's also cancel and reset)

So I think the full list of keys is

  • create
  • update
  • cancel
  • reset
  • submit

I would view the "submit" key as a fallback, used usually when the form's object doesn't smell like an ActiveModel and we can't figure out if it should be a create or update. Try setting an update and submit key and let me know how you go.

I'm leaving this open because we obviously need some documentation around this.


justinfrench commented Jun 6, 2012

Added documentation in 0a81d19, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment