Hi, I have to set those language flags on my website, and depending on which one was selected it should show the pages in specific languages. Problem is that this translation is also needed for the model attributes. How should I do that? Just save many attributes (one for each language) for each attribute I currently have and then set a lot of if''s in my html? Thank you, Rodrigo -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You should have a look at the Rails Internationalization Guide, especially the part about localizing Active Model attributes. http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models Simply set the local for the I18n API: I18n.locale = :de and translate all the active model attributes: en: activerecord: models: user: Dude attributes: user: login: "Handle" # will translate User attribute "login" as "Handle" Hope that helps! On Nov 7, 2:55 pm, Rodrigo Ruiz <rodrigo.ru...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, I have to set those language flags on my website, and depending on > which one was selected it should show the pages in specific languages. > Problem is that this translation is also needed for the model attributes. > > How should I do that? > > Just save many attributes (one for each language) for each attribute I > currently have and then set a lot of if''s in my html? > > Thank you, > Rodrigo-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You need a config/locales/es.something.yml file that looks like: es: [...] activerecord: models: user: Usuario attributes: user: name: Nombre [...] This way you''ll have your attribute and models names translated when you use. Remember to have the same strings translated for, at least, :en and to keep an eye on spaces and indents when editing .yml files form_for :user .... do |f| f.label :name ... Regards. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Rodrigo, There are tools available for this sort of thing, but it seems like you need a bit of orientation first. Check out this guide: http://guides.rubyonrails.org/i18n.html For further questions after that, I recommend this group: http://groups.google.com/group/rails-i18n Best of luck, Walter McGinnis On Nov 8, 2011, at 2:55 AM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, I have to set those language flags on my website, and depending on which one was selected it should show the pages in specific languages. > Problem is that this translation is also needed for the model attributes. > > How should I do that? > > Just save many attributes (one for each language) for each attribute I currently have and then set a lot of if''s in my html? > > Thank you, > Rodrigo > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I meant translation of the content of those attributes, not the name of the attributes On Tue, Nov 8, 2011 at 7:29 AM, Xuan <xuanpa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You need a config/locales/es.something.yml file that looks like: > > es: > [...] > activerecord: > models: > user: Usuario > attributes: > user: > name: Nombre > [...] > > This way you''ll have your attribute and models names translated when > you use. > Remember to have the same strings translated for, at least, :en and to > keep an eye on spaces and indents when editing .yml files > > form_for :user .... do |f| > f.label :name > ... > > Regards. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 8 nov, 23:21, Rodrigo Ruiz <rodrigo.ru...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I meant translation of the content of those attributes, not the name of the > attributesSorry for the misunderstanding. Globalize gem seems to be what you need: https://github.com/svenfuchs/globalize3 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.