Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The setting of a site locale influences the editorial content and template labels and unless a public user registers to a web product/service and actively provides the locale information to the webapp, the webserver has to rely on other means that could help identify the visitors preferred locale.

Determining the locale for a site

There are a number of ways of obtaining some form of locale information. Some of them use advanced techniques such as geolocation based on ping delay or topology, but one of the most common way is to look into the content of HTTP headers that request a web page from the public instance. At least the following three headers are relevant to the locale identification:

  • User-Agent
  • Accept-Language
  • Path

The first one 

...

The Public instance delivers the final page to a page visitor, and tries to deliver it in a way that fulfills the content of the HTTP request for the page. A part of the HTTP request's header defines which languages the visitor (client) is able to understand, and which locale variant of the page is preferred. The part that does this is the Accept-Language request header and may take one of the following three forms:

  • <language>
  • <locale>
  • *

The first represents language expressed as a 2 or 3-character string, the second represents language as a full language tag, the third says "any language" (see Accept-Language and Language Tags in RFC-2616).

...