require_once "include/dba.php";
-if (! function_exists('get_browser_language')) {
/**
* @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
*/
// in case none matches, get the system wide configured language, or fall back to English
return Config::get('system', 'language', 'en');
-}}
+}
function push_lang($language) {
if (isset($a->strings) && count($a->strings)) {
$a->stringsave = $a->strings;
}
- $a->strings = array();
+ $a->strings = [];
load_translation_table($language);
$lang = $language;
}
if (isset($a->stringsave)) {
$a->strings = $a->stringsave;
} else {
- $a->strings = array();
+ $a->strings = [];
}
$lang = $a->langsave;
// l
-if (! function_exists('load_translation_table')) {
/**
* load string translation table for alternate language
*
function load_translation_table($lang) {
$a = get_app();
- $a->strings = array();
+ $a->strings = [];
// load enabled plugins strings
- $plugins = dba::select('addon', array('name'), array('installed' => true));
+ $plugins = dba::select('addon', ['name'], ['installed' => true]);
while ($p = dba::fetch($plugins)) {
$name = $p['name'];
if (file_exists("addon/$name/lang/$lang/strings.php")) {
include("view/lang/$lang/strings.php");
}
-}}
+}
/**
* @brief Return the localized version of the provided string with optional string interpolation
* @return array
*/
function get_available_languages() {
- $langs = array();
+ $langs = [];
$strings_file_paths = glob('view/lang/*/strings.php');
if (is_array($strings_file_paths) && count($strings_file_paths)) {