A Framework to make your project multilanguagual.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kolaente 01266ec459 Updated Travis-CI 6 years ago
examples Added: Add Languagestrings dynamically via function 6 years ago
.travis.yml Updated Travis-CI 6 years ago
LICENSE Initial commit 6 years ago
README.md Added: Change the displayed language function 6 years ago
lang.class.php Updated Travis-CI 6 years ago
test.php Updated Travis-CI 6 years ago


#Mowie Multilanguage

A Class which takes care of deploying your site in multiple languages.


$lang = new lang($defaultLanguage);

The default language, which will be used if the users language is not found, is english. However, you can change this to any language you want.

$lang->setLang($langfile, $lang);
$lang->setLang('langfile.en.php', 'en');

You can either define multiple languagefiles, which contain the languagestrings, or define a folder, where the different files are placed. If you do a folder, the files need to be named clearly. For example lang.en.php.

The script will find the file and use it.

You can also define multiple langfiles to get the strings of (see example.php).

To output a string, simply use the following command:


Where $identifier is the Key OR the value defined in the default's langfile.

###Change the displayed language

You can change the displayed language to one the user selects. To do this, use this command:


##Reserved Identifiers

The two idetifiers __Lang__ and __Countrycode__ are reserved identifiers and used by the script to output a list of all available languages to the user.


A languagefile consists of the following code:

$lang = [];
$lang['__Lang__'] = 'English (English)';
$lang['__Countrycode__'] = 'en_US';

$lang['Home'] = 'Home is where your wifi connects automatically';
$lang['About'] = 'About us';
$lang['Contact'] = 'Contact us';

NOTE: To make sure all your languages are displayed correctly, set the file encoding to UTF-8.


Examples can be found in the examples folder.