Start page

Mykola Zharkikh (Kyiv)

Personal site

?

Language versions

Smereka supports multilingual websites interfaces. The technical foundation of multilingual support is language-aware attributes. If the attribute is defined as language-aware, Smereka creates a separate instance of that attribute for each site language.

Since the page template is defined as language-aware attribute, Smereka provides single multilingual support mechanism for page templates that contain constant language-depending elements of web pages, and for the certain nodes (and thus pages).

The basis for multilingual site is a declaration in the customsettings.php file:

$Languages = array('uk', 'ru', 'en');

This array must contain at least one element that determines the language for monolingual site. For a multilingual site it must contain a definition of each language (in the form of codes with two letters, preferably according to ISO 639-1), which will operate the site.

Declaring the language set does not mean that every web page in Smereka must have all language versions. In Smereka web page may have all the language versions, may only have some options, and may have one option – it depends on the intentions of the editor that create the site content.

In order to give the user a language selector designer must put smeretag <Smereka Module="smeretags/smbar.php" Func="StdLangBar" /> in the place of template and/or pages, where this selector should appear. By default this tag generates a very simple HTML code – the string with the names of languages and related links.

In view mode a set of languages defined by busting available language versions of the node attributes. Language version appears to be available, if at least one of the node attribute have the appropriate language version. Missing languages are not displayed, the current language appears without link. If there is only one language option, no selector displayed.

In edit mode the full selector with all languages displays – so that the editor can add new language versions to node.

If this selector looks too spartan, one can write a self-made module and make it through the smeretag mechanism.

Expansion / changing the language set

To do this, follow next steps:

1. Modify $LangNames array in the customsettings.php file.

2. In Smereka lang directory create a new directory with the name of the language and copy the files from some existing language directory to the new one.

3. Edit the files, replacing language-specific literals with the same for the new language.

4. Add new language versions of all of page templates.

5. Edit some nodes, adding the language-aware attributes for a new language.

Thus one can then test the new language version.