[albatross-users] Internationalization (lookup?), embedding, licensing

Dave Cole djc at object-craft.com.au
Tue Apr 16 20:54:09 EST 2002


>>>>> "Brad" == Brad Clements <bkc at murkworks.com> writes:

Brad> I'm looking for a nice, small scale web application platform for
Brad> use in an embedded linux box. I've looked at Zope, Twisted,
Brad> Webware (don't like Cheetah), Skunkweb and many other
Brad> platforms. I think Albatross looks best for my needs.

Brad> 2. Embedding - Looks small, that's nice

Albatross has already been used in an embedded control system.  I have
been trying to convince the guy to join the mailing list.

Brad> 3. Internationalization - I have to support multiple languages
Brad> and automatically "pick the proper templates" based on the
Brad> client browser settings.

Brad> I think I can get the langauge info from request headers..

Yup.

Brad> What I was thinking of doing was using lookup methods for all
Brad> text.. Then I'd load the appropriate macro set into ctx on each
Brad> request based on the client preferred language.

You could override the execution context load_template() and
load_template_once() to alter the template name based upon the
language header from the browser.

class MyCtx(SimpleAppContext):
    def language_vary(self, name):
        language = self.request.get_header('Accept-Language')
        if language:
            return os.path.join(string.split(language, ',')[0], name)
        return name

    def load_template(self, name):
        name = self.language_vary(name)
        return SimpleAppContext.load_template(name)

    def load_template_once(self, name):
        name = self.language_vary(name)
        return SimpleAppContext.load_template_once(name)

With a bit of effort you could make it more robust.

Brad> Does this make sense? Anyone else tackle this problem?

I think you are the first.

Brad> 4. Might have to support being an xml-rpc server in the
Brad> future. I'm assuming I can hook into Request processing
Brad> somewhere.. anyone try this?

I am not so clear on how to do this.  You might be able to get away
with just doing what Andrew suggested and build a custom Request
class.

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list