Topic: Question about using a GetText .yml file? ref = Beast

I'm enjoying the pleasure of unraveling Beast line by line and came to an interesting part. In the main Forums.index.rhtml file they setup some common display information that coincides with a en.yml file that resides in the \project\lang directory, obviously using the GetText way of doing things.
In this line

<h1 style="margin-top:0;"><%= 'Forums'[:forums_title] %></h1>

it appears they're using a member of a hash to display information that ultimately shows "Forums" on the top of the INDEX view. I see that "forums_title" is sitting in the en.yml file. It looks to me that this value is being called as a member of a hash called "Forums"? It's odd though because why is this hash enclosed in single quotes and WHERE IS IT?
I've scoured the application and find no reference anywhere to a hash named 'Forums'?
I am grateful for any reply.

Re: Question about using a GetText .yml file? ref = Beast

I actually don't think Beast uses GetText anymore; they've ditched it in favour of Gibberish.

Anyhow, as for the how it works, if you look, many Ruby classes (Array, Hash, ActiveRecord etc.) have a method called []. Its exactly the same as any other method in Ruby except it can be written two ways:

# OR

Although you will almost exclusively see it written the second way (just because its prettier)

Anyway, by default the String class has no [] method, but Gibberish adds one which would looks something like this (disclaimer: this code is made up wink):

def [](translatee)
  translations = YAML.load_file("#{Gibberish.current_language}.yml")
  return translations[translatee]

So despite looking like Hash's [] method, they're actually unrelated.

I hope that makes sense,


Re: Question about using a GetText .yml file? ref = Beast

I'm struggling through Beast and wondered if I might ask your advice? It appears that most people that use Beast or Savage Beast simply 'drop' the application (or plugin) in and run with it.
I've not seen one of these sites that have any other applications (besides authorization and such). My plan is to have many applications running as one complete web app and thus I have to 'piece in' each application. I am happy to send you a schematic (off line) if you're interested in my plan.
Point being, I'm not comfortable running an application that I'm not intimate with. If you were in this position would you run with the standard Beast product and try to 'wedge' it in or write a similar application using Beast as a model and simplified to your needs?
I know this is a very subjective question but I'm at that crossroad, and I'm sure you can imagine that my neighbors and family don't have much to say about this.
Thank you for saving me once again,

Re: Question about using a GetText .yml file? ref = Beast

Hi Kathy,

Personally speaking, I would recommend keeping as much as possible homegrown. There are several reasons for this:

- Clashes: If you stick premade apps together there is a high probability they won't work together. Sorting out those problems may take longer than actually coding them from scratch.

- Bloat: In premade apps there's bound to be stuff you don't need, wasting space and resources. Worse still, without studying the app in detail you may miss all its features and end up adding an existing one yourself (I've seen it happen all too often).

- Lack of modularity: Its gonna be a lot harder to consolidate, say, the authorisation systems of all the apps into one universally-used method. And if you forget to modify one section of one app, the whole thing could either break or be left with holes and bugs. As long as your consistent in your code, this is not a problem when making it from scratch.

Now, I wouldn't necessarily recommend doing things from scratch in all frameworks, but development in Rails is so speedy that I reckon it would be worth it. With a few hours work (especially with your knowledge of Beast), I'm sure you could get a bare-bones forum up and running.

Anyway, thats my take on it, but I'm sure other would disagree.

Hope that helps,


Last edited by alexpt (2007-07-04 13:01:23)

Re: Question about using a GetText .yml file? ref = Beast

Thank you for the kind words. I'll follow your advice.

Re: Question about using a GetText .yml file? ref = Beast

@Alex - don't forget the security aspects of "adding" multiple plugins together, there's no gurantee that the authors are as like minded as yourself.

@Kathy - I too faced a similar problem and decided to build my own forum from scratch, essentially I started with a Entity Relationship diagram and built it out from there, for me this was the real difficult part as it forced me to visualise what I really wanted the forum to achieve, e.g. do I want to allow people to quote other messages or allow moderators to move topics between forums. Once this was solved the rest was a case of skinning the app (via CSS) and then authentication - which isn't too difficult.

This was hard work but very rewarding and I don't think I would have been as productive if I'd chosen another language/framework smile

Good luck,