到目前为止,我已经构建了multi-language application.But,我发现通过ActiveAdmin接口编辑我的翻译很麻烦。我希望能够通过这个界面添加/编辑翻译。因为使用seeds.rb不是用户的选项。
在编辑/创建产品时,需要有两个文本字段,在第一个字段中,我可以用我的母语编写产品描述,用英语编写第二个描述。我不想为products表创建新列。我不想使用内置的Globalize3结构。
像category_translations这样的其他表在哪里。
如果我这样做:
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在这里,我试图将locale变量设置为输入,但这完全没有错误。有人也有类似的问题?
发布于 2014-06-06 07:29:25
您应该检查activeadmin-globalize。它为您提供了一个很好的界面来处理有翻译的字段。
用于Globalize3的Gem:https://rubygems.org/gems/activeadmin-globalize3
我还没有测试这个版本,因为我们在我们的项目中使用的是来自:https://github.com/stefanoverna/activeadmin-globalize的activeadmin-globalize。
有一个拉请求降低了activeadmin-globalize的依赖性,因此它可以在Rails 3.2应用程序:https://github.com/stefanoverna/activeadmin-globalize/pull/38中使用。
https://stackoverflow.com/questions/24076369
复制相似问题