return false;
} // END - if
- // Construct FQFN for language file
- $langInclude = sprintf("inc/language/%s_%s.php", $ext_name, getLanguage());
-
- // Is this include there?
- if ((isFileReadable($langInclude)) && (!isset($GLOBALS['ext_loaded']['lang'][$ext_name]))) {
- // Then load it
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Language loaded.");
- $GLOBALS['ext_loaded']['lang'][$ext_name] = true;
- loadIncludeOnce($langInclude);
- } elseif ((isDebugModeEnabled()) && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) {
- // No language file is not so good...
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("WARNING: Extension %s has no language file or we cannot read from it. lang=%s",
- $ext_name, getLanguage()
- ));
- }
+ // Load extension's own language file
+ loadLanguageFile($ext_name);
// Construct FQFN for functions file
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
$ret = $GLOBALS['cache_array']['language'];
} elseif (!empty($lang)) {
// Check if main language file does exist
- if (isFileReadable(constant('PATH') . 'inc/language/'.$lang.'.php')) {
+ if (isFileReadable(constant('PATH') . 'inc/language/' . $lang . '.php')) {
// Okay found, so let's update cookies
setLanguage($lang);
} // END - if
}
// Load the current language file or fixes it to 'de'
-function loadLanguageFile () {
+// If ext_name is empty, load general language support, else load extension's
+// language file.
+function loadLanguageFile ($ext_name = '') {
// Try to get language from session
$mx_lang = getSession('mx_lang');
if (is_null($mx_lang)) $mx_lang = getConfig('DEFAULT_LANG');
// Generate filename
- $INC = sprintf("inc/language/%s.php", SQL_ESCAPE($mx_lang));
+ if (empty($ext_name)) {
+ // Generic
+ $languageInclude = sprintf("inc/language/%s.php", SQL_ESCAPE($mx_lang));
+ } else {
+ // Extension's language file
+ $languageInclude = sprintf("inc/language/%s_%s.php", $ext_name, getLanguage());
+ }
- // Look for file
- if (!isIncludeReadable($INC)) {
+ // Look for file if no extension name is provided
+ if ((empty($ext_name)) && (isIncludeReadable($languageInclude) === false)) {
// Switch to default (DO NOT CHANGE!!!)
setLanguage('de');
- $INC = 'inc/language/de.php';
+ $languageInclude = 'inc/language/de.php';
// And set it temporarily
setConfigEntry('DEFAULT_LANG', 'de');
} // END - if
- // Load language file
- loadIncludeOnce($INC);
+ // Is the file there?
+ if (isIncludeReadable($languageInclude)) {
+ // Load language file
+ loadIncludeOnce($languageInclude);
+ } elseif ((isDebugModeEnabled()) && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) {
+ // No language file is not so good...
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("WARNING: Extension %s has no language file or we cannot read from it. lang=%s",
+ $ext_name, getLanguage()
+ ));
+ }
// Check for installation mode
if ((isInstalling()) || (!isInstalled()) || (!isAdminRegistered())) {