+ $a = get_app();
+
+ // First day of the week (0 = Sunday)
+ $firstDay = get_pconfig(local_user(),'system','first_day_of_week');
+ if ($firstDay === false) $firstDay=0;
+
+ $lang = substr(get_browser_language(), 0, 2);
+
+ // Check if the detected language is supported by the picker
+ if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu")))
+ $lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
+