mberatsanli / multilangphp
Multilang is a language translator library
v2.0.2
2019-12-20 19:08 UTC
Requires
- php: >=7.0
- ext-tokenizer: *
Requires (Dev)
- ircmaxell/php-yacc: 0.0.5
- phpunit/phpunit: ^6.5 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-11-21 21:14:36 UTC
README
Import the library
require_once("lib/multilang.php");
Using
> How to starting
multilang::setup();
> Set Languages Directory
multilang::set("dir", "../demo/langs/");
before mutlilang::setup();
> GET function
multilang::get($req, $return);
> List the language in the defined direcory
echo multilang::listlang($returnType);
> How to create the language file
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";
> How to get the text
echo multilang::lang($type);
$type is a CALLED NAME
// Example echo multilang::lang('test'); // Output (return): Bu bir testtir.
Example Using
// 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