1. What is Multilang?

Multilang is a multiple languages plugin for IncPlugins.

2. Multilang installation

Download the latest Multilang release. It comes with IncPlugins Pro. Unzip it to any temporary directory. Copy multilang.php to your IncPlugins directory. Add the plugin include line to the IncPlugins settings file settings.php.

3. Using Multilang

3.1. Multilingual Methods

Multilang supports two methods of organize multilingual web sites:

Any localized version file name should have a form:

<file name>.<lang>.<file extension>

Here lang is a standard ISO 639 language code like: de, fr, it, ru.

Examples:

index.fr.php
index.de.php
index.ru.php

Your localized pages must be placed in the same directory.

3.2. Languages Set

To specify a set of languages use variable $multilang_list. It contains a string of ,-separated language codes. Example: en,de,fr.

Multilang will use this list to find a right version of your page to show. If user’s language is not supported, a first name from this list is used as a default language. But, if this list contains English, this language will be selected as default even it is located not in the head of the list.

Multilang also supports ex-USSR languages. It selects Russian as default language for ex-USSR languages, because users from ex-USSR know Russian better than English.

You can disable this feature using this setting:

$multilang_exUSSR = false;

Do not forget to specify the languages set in inc.s.php file. Example:

...
include_once $inc_dir.'multilang.php';
$multilang_list = 'en,fr,de,es';
...

3.3. Getting and Setting User’s Language

Multilang uses these sources to calculate user’s language:

The result is stored into IncPlugins variable $lang. If the user’s language is different from a cookie value, the cookie value will be replaced. To set user’s language to the cookie, use HTTP Get parameter in your link. Example:

<a href="page.php?lang=fr">French Version</a>

There is a special value default. It clears user’s browser language cookie.

Multilang also sets these variables:

3.4. Charset Management

Multilang uses a charset value from array $multilang_charset[$lang]. Multilang has predefined variables for most popular languages. But if they are not suit you or absent, create your own values. Example:

$multilang_charset['ru'] = 'windows-1251';

3.5. Language Names

You can get a language name, using this code:

$current_language = $multilang_name[$lang];

Multilang has predefined variables for most popular languages. But if they are not suit you or absent, create your own values. Example:

$multilang_name['it'] = 'Italian';

3.6. Language Controls

You can use these controls in your pages:

Use these functions to insert the controls:

Here are:

3.7. Multilingual File

You can mix multiple languages in the same web page. Example:

<?if ($lang == 'fr'): ?>
    France version text
<?elseif ($lang == 'de'): ?>
    German version text
<?elseif ($lang == 'ru'): ?>
    Russian version text
<?else: ?>
    English version text
<?endif?>