Leo Lukin
Leo Lukin

Reputation: 1211

Customizing model name in ActiveAdmin filter

How can I customise model name in ActiveAdmin filter here? enter image description here

This way doesn't work:

activerecord:
  models:
    category:
      one: "категория"
      other: 'категории'

Upvotes: 1

Views: 1953

Answers (3)

Muntasim
Muntasim

Reputation: 6786

Active Admin uses formtastic to render filter as like the form fields. So you can customize you filters as you like as the formtastic'c customization options are really handy. For example. to change filters label: just use label: 'YOUR CUSTOM LABEL' option in filter method. You can use translations there as well

Upvotes: 0

Fivell
Fivell

Reputation: 11929

ActiveAdmin uses metasearh ,so next rule works for me. (destination - parent model, rateplan - nested model) Example:

en:
  activerecord:
    attributes:
      destination:
       rateplan: "RATEPLAN LOCALIZED NAME"

more info: https://github.com/ernie/meta_search#localization

UPD.

One more soulution is using fortastic rules for internalizaton

en:
  formtastic:
    labels:
      rateplan: "RATEPLAN LOCAIZED"

more info: https://github.com/justinfrench/formtastic#internationalization-i18n

Upvotes: 0

sorens
sorens

Reputation: 5060

filter :title, :label => "Change me"
filter :description, :label => "Change Me"
filter :user, :label => "Change Me"

enter image description here

You could also use I18n.t if you wanted to

    filter :title, :label => (I18n.t "some.key.here")

Upvotes: 1

Related Questions