Date: 10/10/00
- Next message: uw: "[phplib-dev] cvs commit"
- Previous message: uw: "[phplib-dev] cvs commit"
- In reply to: Kristian Köhntopp: "[phplib-dev] [Fwd: phplib Template multilingual extension]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Kristian Köhntopp wrote:
>
> -------- Original Message --------
> From: Michael Kahn <mkahn <email protected>>
> Subject: phplib Template multilingual extension
> To: kk <email protected>
> So in my extension the Template->filename() method has been overridden
> to work like Apache's built-in multilinugal support. First it retrieves
> an array of 2-letter lanugage code preferences from any Accept-Language
> headers in the HTTP request, using a TEMPLATE_DEFAULT_LANGUAGE
> evironment variable to identify the language of the default templates.
> Then it looks in the order of the list for a "$filename.$lang" file, so
> if your list was "fr, en" and your template was "mytemplate.ihtml", it
> would look for "mytemplate.ihtml.fr", then "mytemplate.ihtml.en" (or in
> our case, because the TEMPLATE_DEFAULT_LANGUAGE was en, it would look
> for just "mytemplate.ihtml" in the second case). So, if you use
> $t->set_file("page","mytemplate.ihtml"), it returns the template for the
> first language match on the list that it finds.
Not a big hack. I don't think it should go into the official CVS
but it's well worth to be placed in some kind of "hints & tricks"
section. Only few people know how multi-language applications can
be realized with PHP. Adding it to the official (base) class
would make a very generalized class a specialized one. Maybe we
should provide a derived class containing the suggested features
somewhere in a new section.
Ulf
-- Ulf Wendel NetUSE AG, Siemenswall, 24107 Kiel, Germany Fon: +49 431 386435 00 -- Fax: +49 431 386435 99--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected> For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: uw: "[phplib-dev] cvs commit"
- Previous message: uw: "[phplib-dev] cvs commit"
- In reply to: Kristian Köhntopp: "[phplib-dev] [Fwd: phplib Template multilingual extension]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

