简体   繁体   English

具有区域设置的活动管理员输入字段

[英]Active admin input field with locale

I have built multi-language application.But at this point I see lot of trouble to edit my translations through ActiveAdmin interface. 我已经构建了多语言应用程序。但是此时,通过ActiveAdmin界面编辑翻译存在很多麻烦。 I want to be able add/edit translations through this interface. 我希望能够通过此界面添加/编辑翻译。 Because using seeds.rb is not an option for user. 因为用户不能选择使用seeds.rb。

Idea is to have 2 text fields when editing/creating product, where in the first one I could write product description in my native language and in second description in english. 想法是在编辑/创建产品时有2个文本字段,在第一个字段中,我可以用本国语言写产品描述,在第二个字段中,可以用英语写产品描述。 I don't to create new column for products table. 我不为产品表创建新列。 I wan't to use built in Globalize3 structure. 我不会使用内置的Globalize3结构。

Where is other table like category_translations . 其他表格在哪里,例如category_translations

If I try like this: 如果我这样尝试:

form :html => { :enctype => "multipart/form-data" } do |f|
  f.inputs "Content" do
    f.input :name
    f.input :condition, :collection => @condition,:hint=>"Select condition"
    f.input :sub_desc, :input_html => { :class => "tinymce" }
    f.input :description, :input_html => { :class => "tinymce" },:locale=>'en'
    f.input :description, :input_html => { :class => "tinymce" },:locale=>'lv'  
    f.input :technical_data, :input_html => {:class=>"tinymce" }
    f.input :intro_text
    f.input :category, :collection => @category
    f.input :slug
    f.input :manufacturer, :collection => @manufacturer,:hint=>"Choose manufacturer"
  end
  f.inputs "Image" do 
  f.input :photo, :as => :file, :hint=>"Select image to upload. Allowed file formats *jpg *png, Soft signs not Allowed"
     #form :partial => "form"
  end
  f.actions
  end

Where I am trying to set locale variable to input, but this gives me no errors at all. 我正在尝试将语言环境变量设置为输入的位置,但这完全没有错误。 Somebody had similar problem ? 有人有类似的问题吗?

You should check the activeadmin-globalize gem. 您应该检查activeadmin-globalize gem。 It gives you a nice interface to handle fields that has translations. 它为您提供了一个不错的界面来处理具有翻译的字段。

Gem for Globalize3: https://rubygems.org/gems/activeadmin-globalize3 Gem for Globalize3: https//rubygems.org/gems/activeadmin-globalize3

I have not tested this version, because we are using Globalize in our project with the activeadmin-globalize taken from: https://github.com/stefanoverna/activeadmin-globalize . 我尚未测试此版本,因为我们在项目中使用Globalize,而activeadmin-globalize来自: https : //github.com/stefanoverna/activeadmin-globalize

There is a pull request that lowers the dependency of activeadmin-globalize so it can be used in a Rails 3.2 app: https://github.com/stefanoverna/activeadmin-globalize/pull/38 有一个拉取请求可以降低activeadmin-globalize的依赖性,因此可以在Rails 3.2应用程序中使用: https : //github.com/stefanoverna/activeadmin-globalize/pull/38

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM