[TYPO3-core] FYI: Fixed bug #7450: htmlArea RTE: localization is broken when the RTE is used by a frontend plugin

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Thu Feb 7 23:39:31 CET 2008


Stanislas Rolland schrieb:
> 
> Index: typo3/sysext/rtehtmlarea/class.tx_rtehtmlareaapi.php
> ===================================================================
> --- typo3/sysext/rtehtmlarea/class.tx_rtehtmlareaapi.php	(revision 3121)
> +++ typo3/sysext/rtehtmlarea/class.tx_rtehtmlareaapi.php	(working copy)
> @@ -56,12 +56,13 @@
>  	 * @return	boolean		true if this plugin object should be made available in the current environment and is correctly initialized
>  	 */
>  	public function main($parentObject) {
> -		global $TYPO3_CONF_VARS, $LANG;
> +		global $TYPO3_CONF_VARS, $LANG, $TSFE;
>  		
>  		$this->htmlAreaRTE =& $parentObject;
>  		$this->rteExtensionKey =& $this->htmlAreaRTE->ID;
>  		$this->thisConfig =& $this->htmlAreaRTE->thisConfig;
>  		$this->toolbar =& $this->htmlAreaRTE->toolbar;
> +		$this->LOCAL_LANG =& $this->htmlAreaRTE->LOCAL_LANG;
>  		
>  			// Check if the plugin should be disabled in frontend
>  		if ($this->htmlAreaRTE->is_FE() && $TYPO3_CONF_VARS['EXTCONF'][$this->rteExtensionKey]['plugins'][$this->pluginName]['disableInFE']) {
> @@ -70,7 +71,7 @@
>  			// Localization array must be initialized here
>  		if ($this->relativePathToLocallangFile) {
>  			if ($this->htmlAreaRTE->is_FE()) {
> -				$this->LOCAL_LANG = t3lib_div::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language);
> +				$this->LOCAL_LANG = array_merge_recursive($this->LOCAL_LANG, t3lib_div::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language));
>  			} else {
>  				$LANG->includeLLFile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile);
>  			}


If you call t3lib_div::readLLfile() with $lang, but no $charset (new in 
4.2), you'll get all - also the default language! - strings in 
forceCharset or, if not set, in the "native" charset. If you want a 
specific charset, you may use it as third parameter.

To load a file with the current language/charset settings use 
readLLfile() of $LANG ($LANG->charSet) or $TSFE ($TFE->renderCharset). 
Both functions don't support a $lang parameter.

Index: typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php
===================================================================
--- typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php	(revision 
3122)
+++ typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php	(working copy)
@@ -177,7 +177,7 @@
  		}
  		
  			// Character set
-		$this->charset = $TSFE->labelsCharset;
+		$this->charset = $TSFE->labelsCharset ? $TSFE->labelsCharset : 
$TSFE->renderCharset;
  		$this->OutputCharset  = $TSFE->metaCharset ? $TSFE->metaCharset : 
$TSFE->renderCharset;

$TSFE->labelsCharset (as $LANG->origCharset) is history. Labels are 
returned in the correct charset, usually no need for further conversion 
for normal rendering.

Masi


More information about the TYPO3-team-core mailing list