> I am looking for a templating system for my forum > (http://rforum.rubyforge.org). .. I can't use most of the templating > engines is that I want to make the forum multi-language, so that I can't > write: > [%if logged_in%] > Logged in as [%var username%] > [%endif%] > but would have to write something like > [%if logged_in%] > [%var text_logged_in_as(username)%] > [%endif%] > Does anyone know a templating system I could use? I'm just about to do the same thing (mutli-language), and here's the solution I came up with (so far)... If your output is going to be multi-language and filled with variables, then your HTML template is going to be way more template than HTML. Like your example above. At that point, it seems smarter to shift your focus from "HTML templates to put my Ruby in" to "Ruby class that puts out HTML". ## QUICK UNTESTED EXAMPLE: ## HTML_Template.rb class HTML_Template def initialize(lang) @lang=lang end def header(pagetitle) '<html><head><title>%s - %s</title><head><body>' % [@lang['sitename'], pagetitle] end def loginbox_loggedin(username) '<div class="loginbox">%s %s</div>' % [@lang['logged_in_as'], username] end def loginbox_anon '<div class="loginbox">%s</div>' % [@lang['please_log_in']] end # ... etc # one method for each often-used "chunk" of your website def footer '</body></html>' end end ## Lang.rb english = { 'sitename' => 'RForum', 'logged_in_as' => 'Logged in as', 'please_log_in' => 'Please log in' # etc } ## welcome.rbx load 'Lang.rb' require 'HTML_Template' ht = HTML_Template.new(english) puts ht.header if username puts ht.loginbox_loggedin(username) else puts ht.loginbox_anon end puts ht.footer I might be totally wrong with this. I haven't started my new project yet because I have to finish something else first. But it's just an idea, and I'd love to hear any other suggestions.