Hi, At Tue, 27 Apr 2004 12:48:21 +0900, Austin Ziegler wrote in [ruby-talk:98474]: > When I want to display a message, I do: > > puts @config.message[:no_webmaster_defined] > raise @config.message[:backend_unknown] % ["madaleine"] > > The latter illustrates a rather large problem with this approach, though. I > believe that the only proper answer is tagged-templated translation, but > this is a very heavyweight response. Most messages are NOT fixed messages, > but include information from the program. printf-formats (like I use) are > positional, but that won't work for all languages in all contexts. Ideally, > a fast format would be available that allows me to do: > > :message_1 => "The <:subject> is <:object>." > > Then, it could be translated as (I'm going from a very rusty memory here, so > please forgive me): > > :message_1 => "<:object> ga <:subject> desu." Use %n$ format. $ ruby -e 'printf "%2$s ga %1$s desu.", "object", "subject"' subject ga object desu. # Also in Japanese, `subject' almost comes first in general. # E: subject verb object # J: subject object verb BTW, once I'd proposed the format indexed by name, similar to yours, borrowed from Python: $ ruby -e 'printf "The %(subject)s is %(object)s.", {subject:"system", object:"down"}' The system is down. It was rejected, however, I believe this would be usefull for L10N. -- Nobu Nakada