[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tmda-workers
Subject:    sender-specific templates (was Re: support for different languages
From:       "Jason R. Mastaler" <jason () mastaler ! com>
Date:       2002-10-29 22:43:39
[Download RAW message or body]

"Rainer Jenning" <sartorie@everville.de> writes:

> I came up with an idea for suppport of different languages.
>
> A short search on the list archieves (language;confirm) showed that
> there was (a short) conversation of this topic before. The
> conversation stated that the "common language of the internet" is
> english (and I totally agree).  The solution for non-english
> speaking would be to simply add a translated part to the templates.
>
> Well, I think this is a bad approach since I surely do not want to
> "spam" *g* english users with a english / non-english text.  And
> also I know a few people wo will not read any further if they
> encounter english in their mails ... sad but true ;-)
>
> My idea of implementation is an (as I think) easy and efficent way
> to solve this. I have not found a similiar idea on the lists so here
> is it :
>
> One could tmda have look at the senders domain ending and then look
> for a fitting template - if none is found the english ones are used.

Now that TMDA has the support for multilingual templates, we can
consider ideas like this.

The above is easy to do with a few lines of Python code in
~/.tmda/config. e.g,

  TEMPLATE_DIR = os.path.expanduser('~/.tmda/templates/')
  sender = os.environ.get('SENDER').lower()
  stld = sender.split('.')[-1]
  stld_template_dir = os.path.join(TEMPLATE_DIR, stld)
  if os.path.isdir(stld_template_dir):
      TEMPLATE_DIR = stld_template_dir

Then stick your German translations in ~/.tmda/templates/de/ and
foo@bar.baz.de will get those instead.

My question is, should this be built into TMDA so that users can turn
the behavior on just by toggling a variable?

If so, we could extend this idea by looking for a subdirectory that
matches the sender address, and then increasingly general portions of
the domain part of the address until a match is found, to allow
further specialization.

For example, if mail arrives from foo@bar.baz.de, we'd look for
templates in these subdirectories under TEMPLATE_DIR, in this order:

  foo@bar.baz.de/
  bar.baz.de/
  baz.de/
  de/

If no matches are found, we will backtrack, first into TEMPLATE_DIR,
and then the default locations.

Does this sound like it would be a useful/cool feature to have?
_________________________________________________
tmda-workers mailing list (tmda-workers@tmda.net)
http://tmda.net/lists/listinfo/tmda-workers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic