A Framework to make your project multilanguagual.
Go to file
kolaente 5faeabf1f9 Initial Commit 2016-06-16 13:02:23 +02:00
examples Initial Commit 2016-06-16 13:02:23 +02:00
LICENSE Initial commit 2016-06-16 12:52:17 +02:00
README.md Initial Commit 2016-06-16 13:02:23 +02:00
lang.class.php Initial Commit 2016-06-16 13:02:23 +02:00

README.md

#Mowie Multilanguage

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

##Usage

$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->setLangFolder('../langs');
$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 run the following command:

$lang->get($identifier);
$lang->get('Home');

Where $identifier is the Key OR the value defined in the file.

##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.

##Langfile

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

Examples can be found in the examples folder.