Jim Jones
2007-Nov-29 20:47 UTC
Someone explain this output? <%= ''Last Post''[:last_post] %>
I am looking at the source of the forum software, Beast. For most of the labels within the system, they structure their output like this : <%= ''Last Post''[:last_post] %> From observing the system running, it obviously outputs ''Last Post''. I see that there is a .yml file called en.yml that contains the following: last_post: Last Post Can someone please explain the output statement above? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason Roelofs
2007-Nov-29 21:08 UTC
Re: Someone explain this output? <%= ''Last Post''[:last_post] %>
On Nov 29, 2007 3:47 PM, Jim Jones <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I am looking at the source of the forum software, Beast. > > For most of the labels within the system, they structure their output > like this : > > <%= ''Last Post''[:last_post] %> > > > From observing the system running, it obviously outputs ''Last Post''. > > I see that there is a .yml file called en.yml that contains the > following: > > last_post: Last Post > > > Can someone please explain the output statement above? > -- > Posted via http://www.ruby-forum.com/. > > > >i18n (http://en.wikipedia.org/wiki/Internationalization_and_localization) They''ve monkey-patched String to make the [] method do a string lookup for what text should go there. If nothing''s found, then nothing happens, otherwise the string gets replaced. Jason --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Boutros
2007-Nov-29 21:13 UTC
Re: Someone explain this output? <%= ''Last Post''[:last_post] %>
Yes, and Beast uses a plugin called Gibberish by Christ Wanstrath. What the plugin does is allow you to add several localizations so that you can offer your application in different languages. On Nov 29, 3:47 pm, Jim Jones <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am looking at the source of the forum software, Beast. > > For most of the labels within the system, they structure their output > like this : > > <%= ''Last Post''[:last_post] %> > > From observing the system running, it obviously outputs ''Last Post''. > > I see that there is a .yml file called en.yml that contains the > following: > > last_post: Last Post > > Can someone please explain the output statement above? > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Boutros
2007-Nov-29 21:13 UTC
Re: Someone explain this output? <%= ''Last Post''[:last_post] %>
Yes, and Beast uses a plugin called Gibberish by Christ Wanstrath. What the plugin does is allow you to add several localizations so that you can offer your application in different languages. On Nov 29, 3:47 pm, Jim Jones <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am looking at the source of the forum software, Beast. > > For most of the labels within the system, they structure their output > like this : > > <%= ''Last Post''[:last_post] %> > > From observing the system running, it obviously outputs ''Last Post''. > > I see that there is a .yml file called en.yml that contains the > following: > > last_post: Last Post > > Can someone please explain the output statement above? > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jim Jones
2007-Nov-29 21:20 UTC
Re: Someone explain this output? <%= ''Last Post''[:last_post]
Thanks guys. I appreciate the explanations. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---