require_once("lib/multilang.php");
multilang::setup();
multilang::set("dir", "../demo/langs/");
before mutlilang::setup();
multilang::get($req, $return);
$return | what is does |
---|---|
1 | return |
0 | echo |
$request | what is does | output example |
---|---|---|
lang | Gives you the language selected by the user | en |
dir | Gives you the directory | ../demo/langs/ |
log | Gives the log of the library | array() |
log_last | Gives the last log the library | The current language is set tr |
dir&lang | Gives the language file directory selected by the user | ../demo/langs/tr.php |
echo multilang::listlang($returnType);
$returnType | what is does | output |
---|---|---|
html | Gives languages in html format | div.multilang > [a href="?lang=tr" title="language tr"]tr[/a] |
array | Gives languages in array | array('tr' => 'tr.php') |
For example, the folder with the language files: ../demo/langs/
and we create a language folder in the directory. Create LANGUAGE.php
for example az.php
// '../demo/langs/az.php'
$LANG = array(); // We are creating an array called LANG
$LANG['test'] = "Bu bir testdir.";
$LANG['CALLED_NAME'] = "CONTENTS";
echo multilang::lang($type);
$type is a CALLED NAME
// Example
echo multilang::lang('test'); // Output (return): Bu bir testtir.
// index.php
require_once("lib/multilang.php");
multilang::set("dir", "langs/"); // We defined the language directory
multilang::setup(); // We starting the library
echo multilang::lang("test"); // Echo the text
print_r(multilang::get("log", 1)); // Print the log array