Get the language from settings and re-use it

This commit is contained in:
markjcrane
2025-11-18 09:35:28 -07:00
parent e2981aa9c6
commit 21b85d0316

View File

@@ -83,6 +83,7 @@
private $table; private $table;
private $uuid_prefix; private $uuid_prefix;
private $select_mode; private $select_mode;
private $language;
/** /**
* Called when the object is created * Called when the object is created
@@ -113,6 +114,9 @@
//set the select_mode //set the select_mode
$this->select_mode = $this->settings->get('destinations', 'select_mode', 'default'); $this->select_mode = $this->settings->get('destinations', 'select_mode', 'default');
//get the language
$this->language = $this->settings->get('domain', 'language');
} }
/** /**
@@ -401,7 +405,7 @@
//add multi-lingual support //add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) { if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
$text2 = $language2->get($this->settings->get('domain', 'language'), 'app/'.$name); $text2 = $language2->get($this->language, 'app/'.$name);
} }
if (!empty($row['result']['data']) && !empty($row['select_value'][$destination_type])) { if (!empty($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
@@ -536,11 +540,11 @@
//add multi-lingual support //add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$key."/app_languages.php")) { if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$key."/app_languages.php")) {
$text2 = $language2->get($this->settings->get('domain', 'language'), 'app/'.$key); $text2 = $language2->get($this->language, 'app/'.$key);
$found = 'true'; $found = 'true';
} }
if ($key == 'other') { if ($key == 'other') {
$text2 = $language2->get($this->settings->get('domain', 'language'), 'app/dialplans'); $text2 = $language2->get($this->language, 'app/dialplans');
} }
//add the application to the select list //add the application to the select list
$response .= " <option id='{$singular}' class='{$key}' value='".$key."' $selected>".$text2['title-'.$key]."</option>\n"; $response .= " <option id='{$singular}' class='{$key}' value='".$key."' $selected>".$text2['title-'.$key]."</option>\n";
@@ -614,7 +618,7 @@
//add multi-lingual support //add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) { if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
$language2 = new text; $language2 = new text;
$text2 = $language2->get($this->settings->get('domain', 'language'), 'app/'.$name); $text2 = $language2->get($this->language, 'app/'.$name);
} }
if (!empty($row['result']['data']) && !empty($row['select_value'][$destination_type])) { if (!empty($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
@@ -726,7 +730,7 @@
//add multi-lingual support //add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) { if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
$language2 = new text; $language2 = new text;
$text2 = $language2->get($this->settings->get('domain', 'language'), 'app/'.$name); $text2 = $language2->get($this->language, 'app/'.$name);
} }
if (isset($row['result']) && isset($row['result']['data'][0]) && !empty($row['select_value'][$destination_type])) { if (isset($row['result']) && isset($row['result']['data'][0]) && !empty($row['select_value'][$destination_type])) {