- // Default is 'de'. DO NOT CHANGE THIS!!!
- $ret = 'de';
-
- // Set default return value to default language from config
- if (isConfigEntrySet('DEFAULT_LANG')) $ret = getConfig('DEFAULT_LANG');
-
- // Is the variable set
- if (isGetRequestParameterSet('mx_lang')) {
- // Accept only first 2 chars
- $ret = substr(getRequestParameter('mx_lang'), 0, 2);
- } elseif (isset($GLOBALS['language'])) {
- // Use cached
- $ret = getCurrentLanguage();
- } elseif (isSessionVariableSet('mx_lang')) {
- // Return stored value from cookie
- $ret = getSession('mx_lang');
-
- // Fixes a warning before the session has the mx_lang constant
- if (empty($ret)) $ret = getConfig('DEFAULT_LANG');
- }
+ // Is there cache?
+ if (!isCurrentLanguageSet()) {
+ // Default is 'de'. DO NOT CHANGE THIS!!!
+ $ret = 'de';
+
+ // Set default return value to default language from config
+ if (isConfigEntrySet('DEFAULT_LANG')) {
+ $ret = getDefaultLanguage();
+ } // END - if
+
+ // Is the variable set
+ if (isGetRequestElementSet('mailer_lang')) {
+ // Accept only first 2 chars
+ $ret = substr(getRequestElement('mailer_lang'), 0, 2);
+ } elseif (isCurrentLanguageSet()) {
+ // Use cached
+ $ret = getCurrentLanguage();
+ } elseif (isSessionVariableSet('mailer_lang')) {
+ // Return stored value from cookie
+ $ret = getSession('mailer_lang');
+
+ // Fixes a warning before the session has the mailer_lang constant
+ if (empty($ret)) {
+ $ret = getDefaultLanguage();
+ } // END - if
+ }