翻译Active Admin default_actions

时间:2013-09-14 14:59:38

标签: ruby-on-rails ruby-on-rails-3 activeadmin

我已设置Active Admin with french translation。除了未翻译的表单操作外,一切正常。

例如,我得到Update model而不是Mettre à jour

是否应该在法语翻译文件(fr.yaml)中?

更新

我设法使用formtastic的语言环境文件中的以下yml翻译创建操作:

fr:
  formtastic:
    yes: 'Oui'
    no: 'Non'
    create: 'Créer'
    update: 'Modifier'
    submit: 'Envoyer'
    cancel: 'Annuler'
    reset: 'Réinitialiser'
    required: 'requis'

但是,Update操作无法翻译...

更新2

我将f.actions更改为

f.actions do
  f.action :submit
  f.action :cancel
end

提交现在已翻译。

1 个答案:

答案 0 :(得分:2)

Active Admin使用Formtastic gem。尝试更改formtastic语言环境。

示例:

fr:
  formtastic:
    titles:
      post_details: "Post details"
    labels:
      post:
        title: "Your Title"
        body: "Write something..."
        edit:
          title: "Edit title"
    hints:
      post:
        title: "Choose a good title for your post."
        body: "Write something inspiring here."
    placeholders:
      post:
        title: "Title your post"
        slug: "Leave blank for an automatically generated slug"
      user:
        email: "you@yours.com"
    actions:
      create: "Create my %{model}"
      update: "Save changes"
      reset: "Reset form"
      cancel: "Cancel and go back"
      dummie: "Launch!"

Formtastic I18n Guide