Add a test for the localize function. re #96

This commit is contained in:
Sébastien Lucas 2013-10-04 12:20:34 +02:00
parent 3be4fce3a5
commit 9c09b8797c
2 changed files with 27 additions and 1 deletions

View file

@ -139,7 +139,7 @@ function str_format($format) {
* This method is based on this page
* http://www.mind-it.info/2010/02/22/a-simple-approach-to-localization-in-php/
*/
function localize($phrase, $count=-1) {
function localize($phrase, $count=-1, $reset=false) {
if ($count == 0)
$phrase .= ".none";
if ($count == 1)
@ -149,6 +149,9 @@ function localize($phrase, $count=-1) {
/* Static keyword is used to ensure the file is loaded only once */
static $translations = NULL;
if ($reset) {
$translations = NULL;
}
/* If no instance of $translations has occured load the language file */
if (is_null($translations)) {
$lang = "en";