|
@@ -1,19 +1,16 @@
|
|
<?php
|
|
<?php
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Get the text for the correct translation
|
|
* Get the text for the correct translation
|
|
*
|
|
*
|
|
* @method array get
|
|
* @method array get
|
|
*/
|
|
*/
|
|
class text {
|
|
class text {
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Called when the object is created
|
|
* Called when the object is created
|
|
*/
|
|
*/
|
|
public function __construct() {
|
|
public function __construct() {
|
|
//place holder
|
|
//place holder
|
|
}
|
|
}
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Called when there are no references to a particular object
|
|
* Called when there are no references to a particular object
|
|
* unset the variables used in the class
|
|
* unset the variables used in the class
|
|
@@ -23,7 +20,6 @@ class text {
|
|
unset($this->$key);
|
|
unset($this->$key);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Get a specific item from the cache
|
|
* Get a specific item from the cache
|
|
* @var string $language_code examples: en-us, es-cl, fr-fr, pt-pt
|
|
* @var string $language_code examples: en-us, es-cl, fr-fr, pt-pt
|
|
@@ -39,7 +35,6 @@ class text {
|
|
else {
|
|
else {
|
|
include getcwd().'/app_languages.php';
|
|
include getcwd().'/app_languages.php';
|
|
}
|
|
}
|
|
-
|
|
|
|
//get the available languages
|
|
//get the available languages
|
|
krsort($text);
|
|
krsort($text);
|
|
foreach ($text as $lang_label => $lang_codes) {
|
|
foreach ($text as $lang_label => $lang_codes) {
|
|
@@ -50,7 +45,6 @@ class text {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$_SESSION['app']['languages'] = array_unique($app_languages);
|
|
$_SESSION['app']['languages'] = array_unique($app_languages);
|
|
-
|
|
|
|
//check the session language
|
|
//check the session language
|
|
if(isset($_SESSION['domain'])){
|
|
if(isset($_SESSION['domain'])){
|
|
$language_code = $_SESSION['domain']['language']['code'];
|
|
$language_code = $_SESSION['domain']['language']['code'];
|
|
@@ -63,12 +57,20 @@ class text {
|
|
$text[$key] = $value[$language_code];
|
|
$text[$key] = $value[$language_code];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if ($language_code != 'all') {
|
|
|
|
+ foreach($language_name as $code => $value) {
|
|
|
|
+ $text["language-$code"] = $value;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ foreach($language_name as $code => $value) {
|
|
|
|
+ foreach($language_name as $c_code => $value) {
|
|
|
|
+ $text["language-$code"][$c_code] = $value;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//return the array of translations
|
|
//return the array of translations
|
|
return $text;
|
|
return $text;
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
?>
|
|
?>
|