Project

General

Profile

Feature #17368 » languageCategories3.diff

Administrator Admin, 2007-08-23 01:18

View differences:

t3lib/class.t3lib_div.php (working copy)
} else $csConvObj = NULL;
if (@is_file($fileRef) && $langKey && is_object($csConvObj)) {
// Set charset:
$origCharset = $csConvObj->parse_charset($csConvObj->charSetArray[$langKey] ? $csConvObj->charSetArray[$langKey] : 'iso-8859-1');
......
#'_'.basename($fileRef).
substr(basename($fileRef),10,15).
'_'.t3lib_div::shortMD5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
// Check if cache file exists...
if (!@is_file($cacheFileName)) { // ... if it doesn't, create content and write it:
// Read XML, parse it.
$xmlString = t3lib_div::getUrl($fileRef);
$xmlContent = t3lib_div::xml2array($xmlString);
......
// - kasper
if (is_array($LOCAL_LANG['default'])) {
foreach($LOCAL_LANG['default'] as $labelKey => $labelValue) {
$LOCAL_LANG['default'][$labelKey] = $csConvObj->utf8_decode($labelValue,'iso-8859-1');
if(is_array($labelValue)) {
foreach($labelValue as $catKey => $catValue) {
$LOCAL_LANG['default'][$labelKey][$catKey] = $csConvObj->utf8_decode($catValue,'iso-8859-1');
}
} else
$LOCAL_LANG['default'][$labelKey] = $csConvObj->utf8_decode($labelValue,'iso-8859-1');
}
}
......
// Checking if charset should be converted.
if (is_array($LOCAL_LANG[$langKey]) && $origCharset!='utf-8') {
foreach($LOCAL_LANG[$langKey] as $labelKey => $labelValue) {
$LOCAL_LANG[$langKey][$labelKey] = $csConvObj->utf8_decode($labelValue,$origCharset);
if(is_array($labelValue)) {
foreach($labelValue as $catKey => $catValue) {
$LOCAL_LANG[$langKey][$labelKey][$catKey] = $csConvObj->utf8_decode($catValue,'iso-8859-1');
}
} else
$LOCAL_LANG[$langKey][$labelKey] = $csConvObj->utf8_decode($labelValue,$origCharset);
}
}
}
......
// Read and parse XML content:
$local_xmlString = t3lib_div::getUrl($localized_file);
$local_xmlContent = t3lib_div::xml2array($local_xmlString);
$LOCAL_LANG[$langKey] = is_array($local_xmlContent['data'][$langKey]) ? $local_xmlContent['data'][$langKey] : array();
// Checking if charset should be converted.
if (is_array($LOCAL_LANG[$langKey]) && $origCharset!='utf-8') {
foreach($LOCAL_LANG[$langKey] as $labelKey => $labelValue) {
$LOCAL_LANG[$langKey][$labelKey] = $csConvObj->utf8_decode($labelValue,$origCharset);
if(is_array($labelValue)) {
foreach($labelValue as $catKey => $catValue) {
$LOCAL_LANG[$langKey][$labelKey][$catKey] = $csConvObj->utf8_decode($catValue,'iso-8859-1');
}
} else
$LOCAL_LANG[$langKey][$labelKey] = $csConvObj->utf8_decode($labelValue,$origCharset);
}
}
......
}
?>
?>
typo3/sysext/cms/tslib/class.tslib_pibase.php (working copy)
* @return string The value from LOCAL_LANG.
*/
function pi_getLL($key,$alt='',$hsc=FALSE) {
$langCategory=$GLOBALS['TSFE']->tmpl->setup['config.']['language.']['category'];
if (isset($this->LOCAL_LANG[$this->LLkey][$key])) {
$word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->LLkey][$key], $this->LOCAL_LANG_charset[$this->LLkey][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
if(isset($langCategory) && isset($this->LOCAL_LANG[$this->LLkey][$langCategory][$key]))
$word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->LLkey][$langCategory][$key], $this->LOCAL_LANG_charset[$this->LLkey][$langCategory][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
else
$word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->LLkey][$key], $this->LOCAL_LANG_charset[$this->LLkey][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
} elseif ($this->altLLkey && isset($this->LOCAL_LANG[$this->altLLkey][$key])) {
$word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->altLLkey][$key], $this->LOCAL_LANG_charset[$this->altLLkey][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
if(isset($langCategory) && isset($this->LOCAL_LANG[$this->altLLkey][$langCategory][$key]))
$word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->altLLkey][$langCategory][$key], $this->LOCAL_LANG_charset[$this->altLLkey][$langCategory][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
else
$word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->altLLkey][$key], $this->LOCAL_LANG_charset[$this->altLLkey][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
} elseif (isset($this->LOCAL_LANG['default'][$key])) {
$word = $this->LOCAL_LANG['default'][$key]; // No charset conversion because default is english and thereby ASCII
if(isset($langCategory) && isset($this->LOCAL_LANG['default'][$langCategory][$key]))
$word = $this->LOCAL_LANG['default'][$langCategory][$key]; // No charset conversion because default is english and thereby ASCII
else
$word = $this->LOCAL_LANG['default'][$key]; // No charset conversion because default is english and thereby ASCII
} else {
$word = $this->LLtestPrefixAlt.$alt;
}
......
}
// NO extension of class - does not make sense here.
?>
?>
(4-4/6)