Date: 10/13/00
- Next message: Max Derkachev: "[phplib] [Fwd: [PHP] Re: PHPLIB]"
- Previous message: Mike Green: "Re: [phplib] PHPLIB and oracle binding for >2000 characters"
- In reply to: Kristian Köhntopp: "[phplib] [Fwd: phplib Template multilingual extension]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hiya,
Pardon me if I'm off the mark on this one, but I'm throwing in my 2 cents
anyway :)
The problem I have found with the apache version of this is
that a user logging in on a computer other than their own is stuck using
what you feed them. For example, an Anglophone walks into a public
library in Montreal Quebec (where french is the official language) and
wants to use your site. The pub library's computer is set to retreive
french pages, ordering them as first in the accepted list. The user
speaks English, and would much better benefit them. The problem is the
page is in French.
When doing this you must leave a link at the top of every page allowing
the user to switch default languages. For them to start retrieving EVERY
page in the new language you have to either URL rewrite (or similar) or
use sessions.
You could do something similar, using a default login page with the
language preferences that a user can select for the entire site. Use the
apache <LOCAL> Directive to direct the url to a script, and use the script
to feed template, language sensitive database queries, etc. For example,
the URL:
http://www.yourdomain.de/en/yourpage.html
en is the script that sets the language, checks to see if yourpage.html
exists. If it does it serves it, if not - 404. It's not the most
efficient to query the filesystem for the existence of a page on every
request, but it works. Plus, search engines will index all pages in all
languages.
On Mon, 09 Oct 2000, you wrote:
> -------- Original Message --------
> From: Michael Kahn <mkahn <email protected>>
> Subject: phplib Template multilingual extension
> To: kk <email protected>
>
> Here's the code snippet, hope you find it useful:
>
> function filename($filename) {
> $default_lang = $this->get_default_language();
> // ... (other stuff)
>
> foreach ($this->get_languages() as $lang) {
> if ($lang == $default_lang) {
> $lfile = $filename;
> }
> else {
> $lfile = $filename . ".$lang";
> }
> echo "<!-- looking for ($lfile) -->\n";
> if (file_exists($lfile)) {
> echo "<!-- found $lfile -->";
> return $lfile;
> }
> }
>
> // .... (more cleanup checking, etc)
> }
>
> function get_languages() {
> $headers = getallheaders();
> $language_list =
> preg_replace("/;\s*q=[\d\.]+/","",$headers['Accept-Language']);
> $language_list =
> preg_replace("/\s*/","",$headers['Accept-Language']);
> return explode(",",$language_list);
> }
>
> function get_default_language() {
> $lang = getenv("DEFAULT_TEMPLATE_LANGUAGE");
> return $lang ? $lang : 'en';
> }
-- All your files have been destroyed (sorry). Paul.-------------------------------------------------------- This mail proudly composed and transmitted without the interference of any Micro$oft products or protocols. --------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Max Derkachev: "[phplib] [Fwd: [PHP] Re: PHPLIB]"
- Previous message: Mike Green: "Re: [phplib] PHPLIB and oracle binding for >2000 characters"
- In reply to: Kristian Köhntopp: "[phplib] [Fwd: phplib Template multilingual extension]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

