Language
This module handles documents available in different languages.
Documents get an extra suffix, specifying the languages. For instance,
.sv would be a resource in Swedish, and .en one
in English.
To decide which resource to send to which user, the module looks at
a cookie or a prestate. It does not use the Accept-Language
header of HTTP, since the semantics differ. Accept-Language is based
upon the assumption that the user chooses a fixed list of languages
once, and then automatically gets pages accordingly. The
Language module is based upon the assumption that the
user wants to know which languages a document is available in, and be
able to make the choice any time. The user might well want to look at
the different translations of a page to see if one translation
contains more information.
The Language module is also a directory parsing
module. It has to be in order to handle index.html files in
different languages.
- <language>
-
Prints the language the current page is
in. See the language
page of the Web Site Creator manual for more information.
- <available_languages>
-
Gives a list of all other
languages the current page is available in, and links to them. See the
available_languages
page of the "Web Site Creator"-manual for more information.
- <unavailable_language>
-
Shows the language the
user requested the page in, if the page is not available in that
language. See the unavailable_language
page of the "Web Site Creator"-manual for more information.
Variables
- Default language
-
This is the default language for
documents on this site. It is used when deciding which language file
to send when the user has made no choice. Files without a language
extension are considered to be in this language.
- Languages
-
This specifies which languages are
supported by the site. Support for each language is defined on one
row, on the form language code, language name and
optionally one or more next language code.
An example follows below.
sv Svenska en de
en English de
de Deutsch en
|
The language name is used in the tags to show what language
the page is in and to create links to the other translations.
next language codes are used to determine which language to
use if the one selected is not available. To find a page in an
appropriate language, languages are tried as follows:
- The selected language, stored as a prestate.
- The user agent's accept-headers.
- The default language.
- The default next-language-codes for the default language.
- All languages, in the order listed in this variable.
Empty lines as well as lines beginning with # or
// will be ignored.
- Flag directory
-
The path to a directory holding small
GIF format image files of flags or other symbols, representing the
various languages.
- language-code.selected.gif
-
Shown to indicate
that the page is in that selected language, usually by the
header-module.
- language-code.available.gif
-
Shown as a link to
the page in that language. Only shown if the page is available in that
language.
- language-code.unavailable.gif
-
Shown to
indicate that the user has selected a language that this page is not
available in.
- language-code.dir.selected.gif
-
Shown to
indicate that the directory entry will be shown in that language.
- language-code.dir.available.gif
-
Shown as a
link to the directory entry translated to that language.
- Text only
-
If set the tags will default to text only.
- Use config
-
If set the module will use cookies for
storing the users language preference. Will use prestates otherwise.
|