// @TODO Rewrite all language constants to this function.
function getMessage ($messageId) {
// Default is not found!
- $return = '!'.$messageId.'!';
+ $return = '!' . $messageId . '!';
// Is the language string found?
if (isset($GLOBALS['msg'][strtolower($messageId)])) {
$ret = $GLOBALS['cache_array']['language'];
} elseif (!empty($lang)) {
// Check if main language file does exist
- if (isFileReadable(constant('PATH') . 'inc/language/'.$lang.'.php')) {
+ if (isIncludeReadable('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("NOTICE: 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())) {