*/
function get_browser_language() {
+ $lang_list = [];
if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
- $lang_list = [];
if (count($lang_parse[1])) {
// go through the list of prefered languages and add a generic language
// for sub-linguas (e.g. de-ch will add de) if not already in array
}
// check if we have translations for the preferred languages and pick the 1st that has
- for ($i = 0; $i < count($lang_list); $i++) {
- $lang = $lang_list[$i];
+ foreach ($lang_list as $lang) {
if ($lang === 'en' || (file_exists("view/lang/$lang") && is_dir("view/lang/$lang"))) {
$preferred = $lang;
break;
/**
* load string translation table for alternate language
*
- * first plugin strings are loaded, then globals
+ * first addon strings are loaded, then globals
*
* @param string $lang language code to load
*/
$a = get_app();
$a->strings = [];
- // load enabled plugins strings
- $plugins = dba::select('addon', ['name'], ['installed' => true]);
- while ($p = dba::fetch($plugins)) {
+ // load enabled addons strings
+ $addons = dba::select('addon', ['name'], ['installed' => true]);
+ while ($p = dba::fetch($addons)) {
$name = $p['name'];
if (file_exists("addon/$name/lang/$lang/strings.php")) {
include("addon/$name/lang/$lang/strings.php");