@@ -283,41 +283,41 @@ function init_language() {
283283
284284 $ installed_language = get_installed_language ();
285285 $ installed_language = array_flip ( $ installed_language );
286-
287- $ priority_lang = array ();
286+
287+ $ priority_lang = array ();
288+
289+ // get the languages
290+ $ requested_lang = get ('set_lang_id ' );
291+ if ($ requested_lang )// the first in the priority list is the GET query like ?set_lang_id=en
292+ $ priority_lang [] = $ requested_lang ;
293+
294+ if (isset ($ _SESSION ['lang_id ' ]))// the second on the priority list is the previously established
295+ $ priority_lang [] = $ _SESSION ['lang_id ' ];
296+
297+ if (isset ($ _SERVER ['HTTP_ACCEPT_LANGUAGE ' ])) { // the third is the sent by the browser
288298
289- // get the languages
290- $ requested_lang = get ('set_lang_id ' );
291- if ($ requested_lang )// the first in the priority list is the GET query like ?set_lang_id=en
292- $ priority_lang [] = $ requested_lang ;
293-
294- if (isset ($ _SESSION ['lang_id ' ]))// the second on the priority list is the previously established
295- $ priority_lang [] = $ _SESSION ['lang_id ' ];
296-
297-
298- if (isset ($ _SERVER ['HTTP_ACCEPT_LANGUAGE ' ])) { // the third is the sent by the browser
299- foreach (explode (', ' , $ _SERVER ['HTTP_ACCEPT_LANGUAGE ' ]) as $ part ) {
300- $ priority_lang [] = strtolower (substr ($ part , 0 , 2 ));
301- }
302- }
303-
304- $ priority_lang [] = get_setting ('lang_id ' );// the fourth is the system
305-
306- $ priority_lang = array_unique ( $ priority_lang );
307-
308- // through the list of langs to see which is the best to use
309- while ((list (,$ lang ) = each ($ priority_lang )) && !defined ("LANG_ID " )) {
310- if (isset ($ installed_language [ $ lang ]))
311- define ("LANG_ID " , $ lang );
312- }
313-
314- if (!defined ("LANG_ID " ))// whether the languages listed is not available
315- throw new Exception ("Can not find the language file " );
316-
317- // set the language in session
299+ foreach (explode (', ' , $ _SERVER ['HTTP_ACCEPT_LANGUAGE ' ]) as $ part ) {
300+ $ priority_lang [] = strtolower (substr ($ part , 0 , 2 ));
301+ }
302+ }
303+
304+ $ priority_lang [] = get_setting ('lang_id ' );// the fourth is the system
305+
306+ $ priority_lang = array_unique ( $ priority_lang );
307+
308+ // through the list of langs to see which is the best to use
309+ while ((list (,$ lang ) = each ($ priority_lang )) && !defined ("LANG_ID " )) {
310+ if (isset ($ installed_language [ $ lang ]))
311+ define ("LANG_ID " , $ lang );
312+ }
313+
314+ if (!defined ("LANG_ID " ))// whether the languages listed is not available
315+ throw new Exception ("Can not find the language file " );
316+
317+ // set the language in session
318318 $ _SESSION ['lang_id ' ] = LANG_ID ;
319-
320- // load the dictionaries
319+
320+ // load the dictionaries
321321 load_lang ('generic ' );
322322
323323 }
@@ -559,4 +559,4 @@ protected function _get_load_area( ){
559559 protected function __construct () {}
560560
561561
562- }
562+ }
0 commit comments