unmantained-activeadmin-plugins / activeadmin-globalize

MIT License
51 stars 189 forks source link

Internationalization for translated fields doesn't work #2

Closed bolshakov closed 11 years ago

bolshakov commented 11 years ago
# app/admin.project.rb
ActiveAdmin.register Project do
  form do |f|
      f.translated_inputs do |t|
         t.input :title
      end 
  end
end
# config/locales/ru.yml
ru:
  activerecord:
    attributes:
      project:
        title: Название

I'm expecting label on input field to be 'Title' for English tab and 'Название' for Russian tab. Currently it shows 'Title' for both tabs. Could you help me to solve the problem?

stefanoverna commented 11 years ago

I will try to investigate in the next few days :)

mreq commented 11 years ago

Any news on that? Should be an easy fix.

stefanoverna commented 11 years ago

Not a lot of time available right now. Patch welcome! :)

On Tue, Feb 19, 2013 at 10:33 AM, Petr Marek notifications@github.comwrote:

Any news on that? Should be an easy fix.

— Reply to this email directly or view it on GitHubhttps://github.com/stefanoverna/activeadmin-globalize3/issues/2#issuecomment-13763913.

mreq commented 11 years ago

I was trying, to na avail. I'm not familiar with the insides of active_admin :( BTW Thanks for the gem, works great.

tomeduarte commented 11 years ago

@stefanoverna do you have any idea how to tackle this? I'm willing to give it a go if you can point me in the right direction.

At first glance, I'd say the culprit is here, but I am lost as to why the form builder doesn't use the appropriate locale to build the labels.

Is this right, or am I looking at this totally wrong?

stefanoverna commented 11 years ago

Hey there, 0862d3863dee2f fixes this. You can specify to change locale for each tab using the switch_locale option.

mreq commented 11 years ago

Great work, thanks!

tomeduarte commented 11 years ago

Thank you for fixing that. I wasn't aware of I18n.with_locale, always learning! :smiley:

marcusg commented 11 years ago

@stefanoverna: thanks for that. But that fix only changes the translations for the tabs, not the text for the labels right?

tomeduarte commented 11 years ago

@marcusg I found my labels started to display correctly by adding them as formtastic labels.

Example:

"pt-PT":
  formtastic:
    labels:
      model_name:
        attribute_name: Exemplo
        another_attribute: Exemplo 2

Let me know if that helps :smile:.

stefanoverna commented 11 years ago

nope, it should actually fix also the labels

On Mon, Mar 18, 2013 at 4:43 PM, Marcus Geißler notifications@github.comwrote:

@stefanoverna https://github.com/stefanoverna: thanks for that. But that fix only changes the translations for the tabs, not the text for the labels right?

— Reply to this email directly or view it on GitHubhttps://github.com/stefanoverna/activeadmin-globalize3/issues/2#issuecomment-15062066 .

marcusg commented 11 years ago

ohhh yeah... with the use of the formtastic scope it works. thanks for your help!