Topic: What do all these little 'underscores' mean in Beast?

I've been wonderfully enjoying learning how the internals of Beast are put together and thank all of you who've been so helpful. Unfortunately, I'm still the 'pest' and have another question. Look at this code;

<%= form.check_box :sticky %> <%= _('Sticky') %>
</label>
<label style="margin-left:1em;">
<%= form.check_box :locked %> <%= _('Locked') %>

See all those little " _( " in there. I've tried to run code like this and it always blows and I can't imagine what those little 'critters' are or how I can define them in my program. Are they something like HAML or another page description language?
As always, I'm happy to help those that are trying to 'unravel' Beast and appreciate any thoughts on this.
Thank you,
Kathy

Re: What do all these little 'underscores' mean in Beast?

Looks like it has something to do with using GetText to help build multilingual websites. If you don't have that installed, it'll define the _ method at the bottom of config/environment.rb

Using Gettext To Translate Your Rails Application
http://manuals.rubyonrails.com/read/chapter/105

Vincent Woo Ruby on Rails Blog

Re: What do all these little 'underscores' mean in Beast?

Vincent,
So right you are! For anyone following this thread I enclose the code in my Environment.rb file.

begin
  require 'gettext/rails'
  GetText.locale = "nl" # Change this to your preference language
  puts "GetText found!"
rescue MissingSourceFile, LoadError
  puts "GetText not found.  Using English."
  class ActionView::Base
    def _(s)
      s
    end
  end
end

Do you think that the "_(" wakes up instantiation of the ActionView object?
Thanks again,
Kathleen

Re: What do all these little 'underscores' mean in Beast?

Sorry, I'm not exactly sure where Rails creates the ActionView object. It doesn't instantiate here though. It's just adding a custom method to the ActionView::Base class so it'll be available later.

btw, the code you pasted in is Beast specific. It isn't part of a vanilla environment.rb file.

Vincent Woo Ruby on Rails Blog