I've been working with the Rails framework for a little while now and I really like it. A couple of weeks ago i was giving a small workshop on rails at CATS in seattle and somebody mentioned that they'd tried to walk through the tutorial, but found it wasn't very useful. I'd found it useful when I first started with Rails in August, so it got me to go back and look it over.
They were right, the good tutorial had fallen apart. The wiki, while active, had nobody gardening the tutorial. About the point at which you start getting in to the real tutorial, step 6 of 11, the links were broken. I asked around the irc channel and nobody had any good reason for it to be broken. So i went through and fixed it. Then i got dragged in to noticing there were other places the documentation was sorely lacking when i went to find out how to use layouts and templates.
Now there are nice pages for templates, the scripts for new_model, new_controller, and new_mailer, etc... The Templating section i think still needs a lot of work, as that could be a whole site worth of tips, tricks, howto's, and documentation.
Two issues have come up in this trying to organize the documentation. One is that the current templating system has some rather large security holes if you ever let an untrusted user edit templates. For building ASP type hosted applications where allow the user to customize the look beyond just changing css, this is an issue. One solution mentioned, which needs further exploration, is using a second embedded templating system such as textile, or bluecloth (markdown). I don't like either very much, I'd rather have something properly sandboxed like Template Toolkit does for perl.
The second issue which has come up, is the lack of a clear plan for i18n and l10n (internationalization and localization) of apps written using Rails. I feel pretty strongly that this should be something integrated in to the framework. Especially for native english speaking programmers, if there isn't a framework in place for expecting and using language bundles, then it won't get used. One of the best things which struts does, is clearly put that in the view part of the framework.
Unfortunately, the knowledge about how to i18n and l10n is not spread widely, even though it's not rocket science. Gunner and folks are organizing a localization conference in poland next week for programmers working for nonprofits and civil society organizations. The best article i've seen on i18ning of web apps is about the perl maketext library.
For ruby there are a few ruby i18n packages, mostly based on mo files or gettext. None of them really appeal to me as having the flexibility of maketext. For now the best thing is probably to create hooks in to ActionView for what ever l10n package the coder wants to use. The default should be ruby-gettext.
If a new directory in the rails folder is created for bundles, then ActionView could create and load a gettext library and files. Two things needs to be addressed. First is handling the definition of what language is being requested, this should probably be added to ActionController, and the second is display in the templates.
It would be pretty easy to do it right now with:
<%= Gettext.gettext( 'messageid' ) %>.
The problem is that's really wordy, and will require repeating text which reduces the readability of the templates. Another option is to create a third template tag such as <%- messageid %>. All tags with <%- would look up to the gettext library directly.
I haven't started hacking, but i bet the whole thing is doable with ActionController::Filters and you wouldn't even have to modify the base rails package to get it working. That's part of i really like about rails, every time i want to do something which i think would require futzing with the framework, I found out you don't need to do it, it's easily extendable. Sure, i think more folks would i18n their apps if it was clearly integrated in to rails, but it's not necessary.
Posted by rabble at November 16, 2004 12:26 AM | TrackBackHey Brother I have this fancy new computer and I hear you are going back to Uruguay. I am interested in the rails-ruby-Wiki info,especially the wikipedia, however, Gail thinks I am becoming addicted to the computer,too bad. My point being I am using your blog to learn how to create my own blog eventually. A photo/art blog for the menopausal misfits like me,who listen to Slum village and buy property.I miss you ...Barb
Posted by: Natashalatrasha at November 20, 2004 01:27 PMwell, I don't think you ca have "<%-" tags easoly, but with ruby-gettext you should have
"<%_" by default, since the "_" method gets defined from ruby-gettext.