phpbar.de logo

Mailinglisten-Archive

[php] Spracheinstellungen

[php] Spracheinstellungen

Bernhard Ostheimer bernhard.ostheimer_(at)_uni-mainz.de
Sat, 29 Jan 2000 16:08:52 +0100


Hi,

 >weiß jemand von euch wie man die Spracheneinstellung eines Browsers
 >abfrägt?

1. Javascript (massig Nachteile):
aus Stefan Muenz (tech.htm#a5):
"<script language="JavaScript"> if(navigator.language == "en") 
document.write("dear vistor, welcome on our pages"); else 
if(navigator.language == "de") document.write("Sehr geehrter Besucher, 
willkommen auf unseren Seiten"); </script>"

2. HTTP-Header (wenn mitgeschickt...):
mit getenv(); den Header: Accept-Language auslesen (HTTP/1.1 s.a. RFC2616)
RFC 2616, S.102f:
"14.4 Accept-Language
The Accept-Language request-header field is similar to Accept, but 
restricts the set of natural languages that are preferred as a response to 
the request. Language tags are defined in section 3.10. Accept-Language = 
"Accept-Language" ":" 1#( language-range [ ";" "q" "=" qvalue ] ) 
language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" ) Each 
language-range MAY be given an associated quality value which represents an 
estimate of the user's preference for the languages specified by that 
range. The quality value defaults to "q=1". For example, Accept-Language: 
da, en-gb;q=0.8, en;q=0.7 would mean: "I prefer Danish, but will accept 
British English and other types of English." A language-range matches a 
language-tag if it exactly equals the tag, or if it exactly equals a prefix 
of the tag such that the first tag character following the prefix is "-". 
The special range "*", if present in the Accept-Language field, matches 
every tag not matched by any other range present in the Accept-Language 
field. Note: This use of a prefix matching rule does not imply that 
language tags are assigned to languages in such a way that it is always 
true that if a user understands a language with a certain tag, then this 
user will also understand all languages with tags for which this tag is a 
prefix. The prefix rule simply allows the use of prefix tags if this is the 
case. The language quality factor assigned to a language-tag by the 
Accept-Language field is the quality value of the longest language- range 
in the field that matches the language-tag. If no language- range in the 
field matches the tag, the language quality factor assigned is 0. If no 
Accept-Language header is present in the request, the server SHOULD assume 
that all languages are equally acceptable. If an Accept-Language header is 
present, then all languages which are assigned a quality factor greater 
than 0 are acceptable. [...]"

3. Ueber IP-Adresse:
ist unsicher und viel Arbeit.

HTH,
Bernhard aka Osti
--
Bernhard Ostheimer
E-Mail: Bernhard.Ostheimer_(at)_Uni-Mainz.de
** Datenbankgestuetztes Web-Publishing-System fuer Hochschulen **
** CeBIT 2000 * 24.02.-01.03. * Hannover * Halle 16, Stand B43 **


php::bar PHP Wiki   -   Listenarchive