0

I have built multi-language application.But at this point I see lot of trouble to edit my translations through ActiveAdmin interface. I want to be able add/edit translations through this interface. Because using seeds.rb is not an option for user.

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. I don't to create new column for products table. I wan't to use built in Globalize3 structure.

Where is other table like 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 ?

Chris Salzberg
  • 27,099
  • 4
  • 75
  • 82
Edgars
  • 913
  • 1
  • 19
  • 53

1 Answers1

2

You should check the activeadmin-globalize gem. It gives you a nice interface to handle fields that has translations.

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.

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

dtengeri
  • 937
  • 10
  • 21
  • What is the difference between those two ? – Edgars Jun 08 '14 at 08:52
  • 1
    Globalize3 is deprecated. Globalize is the actual branch. activeadmin-globalize uses the newer one. – dtengeri Jun 08 '14 at 10:04
  • 1
    There is a pull request that makes activeadmin-globalize available under Rails 3. You should check it: https://github.com/stefanoverna/activeadmin-globalize/pull/38 – dtengeri Jun 08 '14 at 10:09