LMPHP
| Original author(s) | Max Base |
|---|---|
| Developer(s) | Max Base |
| Initial release | 2018 |
| Stable release | 1.1
/ January 2019 |
| Engine | |
| Operating system | Cross-platform |
| Type | PHP Library |
| License | GNU General Public License v3.0 |
| Website | MultiLanguagePHP at Github |
Search LMPHP on Amazon.LMPHP[1] (Language management PHP)[2] is a library for language management and multi-language support in PHP-based application backends. A key feature is supporting multi-language in projects. [3] [4][5]
MultiLanguagePHP is used primarily for language management and multi-language support.
This library is licensed under GNU General Public License v3.0 [6] and is open-source[7].
This package is published in the Official PHP Classes Repository[8]. [9]
This package was a reason Max ranked first in the US and 4th in the world in 2019/02. [10][11]
Functionalities
- Language management and multi-language support.
- Enable language with more priority (activate a language)
- Trying to eliminate vocabulary deficiencies in some languages.
History
| Version Num | Date Begin | Date Finish |
|---|---|---|
| 0.1 (first) | 2018 | 2018-12-01 |
| 1.0 | 2018-12-01 | 2019-01-22 |
| 1.1 | 2019-01-22 | - |
- In 2018, Max Base[13] began designing this library. [2]
- In 2018, this library was used in one of India's projects for language management. [2]
- Version 1.0, a nearly complete rewrite, was released on Dec 1, 2018.[14]
- In 2019, the name of this library changed from MultiLanguagePHP to LM-PHP. [1][15]
- Version 1.1 was officially introduced with the new name as LMPHP. [16][17][18]
- In 2019/01, This package was published in the Official PHP Classes Repository.[8]
- In 2019/01/25, this package has also been downloaded and used up to 9,384 times.[10]
- In 2019/02/27, ranked first in the US (This week)
- In 2019/03/05, ranked first in Canada (This week) [19]
Functions
| Function Name | Goal | Parameter(s) | Return |
|---|---|---|---|
| word_add | Add a word to the active language. | $name(name of the word),
Optional : $value(value of the word) |
Bool |
| word_get | Get a word from the active language. | $name(name of the word) | The value of the word. |
| word_add_to | Add a word to the custom language. | $lang(language name),
$name(name of the word), Optional : $value(value of the word) |
Bool |
| language_add | Add a new language. | $key(language name) | Bool |
| language_remove | Remove a language. | $key(language name) | Bool |
| language_active | Activate a language. | $key(language name) | Bool |
| language_current | Get current active language. | Name of the active language. | |
| language_exists | Check if a language exists or not. | $key(language name) | Bool |
| language | Get the list of the languages or list of the words of a language. | Optional : $filter(language name) | Array |
Initial
E.g.: We define the class in $langs variable.
$langs = new MultiLanguages();
WordAdd
$langs -> word_add("Bye","Good Bye!");
$langs -> word_add("HowAre");
WordAddTo
$langs -> word_add_to("en","Bye","Good Bye!");
$langs -> word_add_to("ar","HowAre");
WordGet
echo $langs -> word_get("Bye");
LanguageAdd
$langs -> language_add("en");
$langs -> language_add("ar","Arabic");
LanguageRemove
$langs -> language_remove("en");
LanguageActive
$langs -> language_active("ar");
LanguageCurrent
if($langs -> language_current() == "ar")
{
print("is ar");
}
else
{
print("is not ar, is " . $langs -> language_current() );
}
LanguageExists
if($langs -> language_exists("ar"))
{
print("true");
}
else
{
print("false");
}
Languages
print_r( $langs -> languages );
Example
<?php
/**
*
* @Name : LMPHP (Language management, Multi-Language)
* @Version : 1.1
* @Programmer : Max
* @Date : 2018-12-01 - 2019-01-22
* @Released under : https://github.com/BaseMax/LMPHP/blob/master/LICENSE
* @Repository : https://github.com/BaseMax/LMPHP
*
**/
include "LMPHP.php";
$langs = new LMPHP();
$langs -> language_add("en");
$langs -> language_add("fa","Farsi");
//$langs -> language_remove("en");
$langs -> language_active("fa");
echo $langs -> language;
print_r( $langs -> languages );
$langs -> language_active("en");
$langs -> word_add("Bye","Good Bye!");
$langs -> language_active("fa");
$langs -> word_add("Hi","Hello!");
$langs -> word_add("HowAre");
$langs -> word_add("HowAre","How are you?");//update a word!
print_r( $langs -> words );
echo $langs -> word_get("Bye");//It should get word from active language(fa) , but this is not exists. so will get value from en.
?>
Short Example
<?php
include "LMPHP.php";
/////////////////////////////
$langs = new LMPHP();
$langs -> language_add("en","English");
$langs -> language_add("fr","Germany");
$langs -> language_active("en");
$langs -> word_add("Bye","Good Bye!");
$langs -> word_add("HowAre");
$langs -> language_active("fr");
$langs -> word_add("Bye","Au revoir!");
print_r( $langs -> words );
echo $langs -> word_get("Bye");
?>
References
- ↑ 1.0 1.1 "Set name as LMPHP(LM-PHP)".
- ↑ 2.0 2.1 2.2 "README".
- ↑ "List of all code-repository in the 'multi language-support' category for the PHP".
- ↑ "List of all code-repository in the 'multi-language' category for the PHP".
- ↑ "LMPHP (New)". Free PHP.
- ↑ "GNU General Public License v3.0".
- ↑ 7.0 7.1 "multilingual - Multi language php script". Stack Overflow. Retrieved 2019-01-20.
- ↑ 8.0 8.1 "LMPHP: Support to multiple languages to PHP applications - PHP Classes". www.phpclasses.org. Retrieved 2019-01-25.
- ↑ "PHP Classes | RedSign Cloud". redsign.cloud. Retrieved 2019-02-28.
- ↑ 10.0 10.1 "LMPHP: Support to multiple languages to PHP applications - PHP Classes". web.archive.org. 2019-01-25. Archived from the original on 2019-01-25. Retrieved 2019-01-25.CS1 maint: Unfit url (link)
- ↑ "Asrez". asrez.com. Retrieved 2019-06-10.
- ↑ "History version table with date (Ver 1.0 and1.1)".
- ↑ "Max Base - Profile".
- ↑ "Code Repository".
- ↑ "Update and rename MultiLanguages.php to LMPHP.php".
- ↑ "Change the name of the class".
- ↑ "What is the LMPHP?". Max. 2019-01-22. Retrieved 2019-01-21.
- ↑ "basemax/lmphp - Packagist". packagist.org. Retrieved 2019-01-22.
- ↑ "Classes of Max Base - PHP Classes". web.archive.org. 2019-03-05. Archived from the original on 2019-03-05. Retrieved 2019-03-05.CS1 maint: Unfit url (link)
- ↑ "Name Functions".
- ↑ "Source Code".
- ↑ 22.0 22.1 Example Using, Multi-language management and support on the site.: BaseMax/LMPHP
- ↑ "Update Sample.php for the new name. (LMPHP)".
- ↑ "Rename 'MultiLanguages' to 'LMPHP' in the stackoverflow answer".
This article "LMPHP" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:LMPHP. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
