* Fixed bug #7450 (revisited): further corrections to localization of htmlArea RTE
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 8 Feb 2008 16:08:16 +0000 (16:08 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 8 Feb 2008 16:08:16 +0000 (16:08 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3135 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/class.tx_rtehtmlareaapi.php
typo3/sysext/rtehtmlarea/extensions/BlockElements/class.tx_rtehtmlarea_blockelements.php
typo3/sysext/rtehtmlarea/extensions/BlockElements/locallang.xml
typo3/sysext/rtehtmlarea/extensions/DefaultFont/class.tx_rtehtmlarea_defaultfont.php
typo3/sysext/rtehtmlarea/extensions/InlineElements/class.tx_rtehtmlarea_inlineelements.php
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php

index 2e82bbe..cfd45ff 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-08  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Fixed bug #7450 (revisited): further corrections to localization of htmlArea RTE
+
 2008-02-08  Ingo Renner  <ingo@typo3.org>
 
        * Release of TYPO3 4.2.0beta1a
index 4bc7fbb..601b9d1 100644 (file)
@@ -1,3 +1,7 @@
+2008-02-08  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Fixed bug #7450 (revisited): further corrections to localization of htmlArea RTE
+
 2008-02-07  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Fixed bug #4588: Frontend htmlArea RTE loads global RTE config instead of function parameter $thisConfig
index 1e83d49..369d8ff 100644 (file)
@@ -138,11 +138,11 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
        var $RTEsetup;
        var $thisConfig;
        var $confValues;
-       var $language;
+       public $language;
        public $contentTypo3Language;
        public $contentISOLanguage;
        public $contentCharset;
-       var $OutputCharset;
+       public $OutputCharset;
        var $editorCSS;
        var $specConf;
        var $toolbar = array();                                 // Save the buttons for the toolbar
@@ -1104,25 +1104,25 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                $JSLanguageArray .= 'HTMLArea_langArray = { ' . $linebreak;
                $subArrays = array( 'tooltips', 'msg' , 'dialogs');
                $subArraysIndex = 0;
-               foreach($subArrays as $labels) {
+               foreach ($subArrays as $labels) {
                        $JSLanguageArray .= (($subArraysIndex++)?',':'') . $labels . ': {' . $linebreak;
-                       if($this->is_FE()) {
-                               $LOCAL_LANG = $TSFE->readLLfile(t3lib_extMgm::extPath($this->ID).'htmlarea/locallang_' . $labels . '.xml');
+                       if ($this->is_FE()) {
+                               $LOCAL_LANG = t3lib_div::readLLfile('EXT:' . $this->ID . '/htmlarea/locallang_' . $labels . '.xml', $this->language, $this->OutputCharset);
                        } else {
                                $LOCAL_LANG = $LANG->readLLfile(t3lib_extMgm::extPath($this->ID).'htmlarea/locallang_' . $labels . '.xml');
                        }
-                       if(!empty($LOCAL_LANG[$this->language])) {
+                       if (!empty($LOCAL_LANG[$this->language])) {
                                $LOCAL_LANG[$this->language] = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG['default'], $LOCAL_LANG[$this->language]);
                        } else {
                                $LOCAL_LANG[$this->language] = $LOCAL_LANG['default'];
                        }
                        $index = 0;
-                       foreach ( $LOCAL_LANG[$this->language] as $labelKey => $labelValue ) {
+                       foreach ($LOCAL_LANG[$this->language] as $labelKey => $labelValue ) {
                                $JSLanguageArray .=  (($index++)?',':'') . '"' . $labelKey . '":"' . str_replace('"', '\"', $labelValue) . '"' . $linebreak;
                        }
                        $JSLanguageArray .= ' }' . chr(10);
                }
-               $JSLanguageArray .= ' }' . chr(10);
+               $JSLanguageArray .= ' };' . chr(10);
                return $JSLanguageArray;
        }
        
@@ -1187,18 +1187,18 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
         */
         
        function buildJSLangArray($plugin) {
-               global $TSFE, $LANG, $TYPO3_CONF_VARS;
+               global $LANG, $TYPO3_CONF_VARS;
 
                $extensionKey = is_object($this->registeredPlugins[$plugin]) ? $this->registeredPlugins[$plugin]->getExtensionKey() : $this->ID;
 
                $linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);
                if($this->is_FE()) {
-                       $LOCAL_LANG = $TSFE->readLLfile(t3lib_extMgm::extPath($extensionKey).'htmlarea/plugins/' . $plugin . '/locallang.xml');
+                       $LOCAL_LANG = t3lib_div::readLLfile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $plugin . '/locallang.xml', $this->language, $this->OutputCharset);
                } else {
                        $LOCAL_LANG = $LANG->readLLfile(t3lib_extMgm::extPath($extensionKey).'htmlarea/plugins/' . $plugin . '/locallang.xml');
                }
 
-               if(!empty($LOCAL_LANG[$this->language])) {
+               if (!empty($LOCAL_LANG[$this->language])) {
                        $LOCAL_LANG[$this->language] = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG['default'],$LOCAL_LANG[$this->language]);
                } else {
                        $LOCAL_LANG[$this->language] = $LOCAL_LANG['default'];
@@ -1207,10 +1207,10 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                $JSLanguageArray .= 'var ' . $plugin . '_langArray = new Object();' . $linebreak;
                $JSLanguageArray .= $plugin . '_langArray = {' . $linebreak;
                $index = 0;
-               foreach ( $LOCAL_LANG[$this->language] as $labelKey => $labelValue ) {
+               foreach ($LOCAL_LANG[$this->language] as $labelKey => $labelValue ) {
                        $JSLanguageArray .=  (($index++)?',':'') . '"' . $labelKey . '":"' . str_replace('"', '\"', $labelValue) . '"' . $linebreak;
                }
-               $JSLanguageArray .= ' }' . chr(10);
+               $JSLanguageArray .= ' };' . chr(10);
                
                return $JSLanguageArray;
        }
@@ -1290,10 +1290,15 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
        }
        
        public function getPageConfigLabel($string,$JScharCode=1) {
-               global $LANG, $TSFE;
+               global $LANG, $TSFE, $TYPO3_CONF_VARS;
                
                if ($this->is_FE()) {
-                       $label = $TSFE->csConvObj->conv($TSFE->sL(trim($string)), $TSFE->renderCharset, $TSFE->metaCharset);
+                       if (strcmp(substr($string,0,4),'LLL:') && $TYPO3_CONF_VARS['BE']['forceCharset'])       {
+                                       // A pure string coming from Page TSConfig must be in forceCharset, otherwise we just don't know..
+                               $label = $TSFE->csConvObj->conv($TSFE->sL(trim($string)), $TYPO3_CONF_VARS['BE']['forceCharset'], $this->OutputCharset);
+                       } else {
+                               $label = $TSFE->csConvObj->conv($TSFE->sL(trim($string)), $this->charset, $this->OutputCharset);
+                       }
                        $label = str_replace('"', '\"', str_replace('\\\'', '\'', $label));
                        $label = $JScharCode ? $this->feJScharCode($label) : $label;
                } else {
index 03778f0..3924d63 100644 (file)
@@ -71,7 +71,7 @@ abstract class tx_rtehtmlareaapi {
                        // Localization array must be initialized here
                if ($this->relativePathToLocallangFile) {
                        if ($this->htmlAreaRTE->is_FE()) {
-                               $this->LOCAL_LANG = array_merge_recursive($this->LOCAL_LANG, t3lib_div::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language));
+                               $this->LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($this->LOCAL_LANG, t3lib_div::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language));
                        } else {
                                $LANG->includeLLFile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile);
                        }
index 5da4643..d631fe7 100644 (file)
@@ -70,7 +70,7 @@ class tx_rtehtmlarea_blockelements extends tx_rtehtmlareaapi {
                'h6'            => 'Heading 6',
                'pre'           => 'Preformatted',
                'address'       => 'Address',
-               'blockquote'    => 'Quotation',
+               'blockquote'    => 'Long quotation',
                'div'           => 'Section',
        );
        
@@ -134,7 +134,7 @@ class tx_rtehtmlarea_blockelements extends tx_rtehtmlareaapi {
                        if ($this->htmlAreaRTE->cleanList($this->thisConfig['hidePStyleItems']) != '*') {
                                foreach ($blockElementsOrder as $item) {
                                        if ($this->htmlAreaRTE->is_FE()) {
-                                               $blockElementsOptions[$item] = $TSFE->csConvObj->conv($TSFE->getLLL($this->defaultBlockElements[$item],$this->LOCAL_LANG), $this->htmlAreaRTE->charset, $this->htmlAreaRTE->OutputCharset);
+                                               $blockElementsOptions[$item] = $TSFE->getLLL($this->defaultBlockElements[$item],$this->LOCAL_LANG);
                                        } else {
                                                $blockElementsOptions[$item] = $LANG->getLL($this->defaultBlockElements[$item]);
                                        }
index 5855f3a..a4e1766 100644 (file)
@@ -16,7 +16,7 @@
                        <label index="Heading 5">Heading 5</label>
                        <label index="Heading 6">Heading 6</label>
                        <label index="Preformatted">Preformatted</label>
-                       <label index="Quotation">Quotation</label>
+                       <label index="Long quotation">Quotation</label>
                        <label index="Address">Address</label>
                        <label index="Section">Container</label>
                </languageKey>
index 7f17364..64f799b 100644 (file)
@@ -134,7 +134,7 @@ class tx_rtehtmlarea_defaultfont extends tx_rtehtmlareaapi {
                $defaultFontFacesList = 'nofont,';
                if ($this->htmlAreaRTE->is_FE()) {
                        $HTMLAreaFontname['nofont'] = '
-                               "' . $TSFE->csConvObj->conv($TSFE->getLLL('No font',$this->LOCAL_LANG), $this->htmlAreaRTE->charset, $this->htmlAreaRTE->OutputCharset) . '" : ""';
+                               "' . $TSFE->getLLL('No font', $this->LOCAL_LANG) . '" : ""';
                } else {
                        $HTMLAreaFontname['nofont'] = '
                                "' . $LANG->getLL('No font') . '" : ""';
@@ -201,7 +201,7 @@ class tx_rtehtmlarea_defaultfont extends tx_rtehtmlareaapi {
                        // Builing JS array of default font sizes
                $HTMLAreaFontSizes = array();
                if ($this->htmlAreaRTE->is_FE()) {
-                       $HTMLAreaFontSizes[0] = $TSFE->csConvObj->conv($TSFE->getLLL('No size',$this->LOCAL_LANG), $this->htmlAreaRTE->charset, $this->htmlAreaRTE->OutputCharset);
+                       $HTMLAreaFontSizes[0] = $TSFE->getLLL('No size', $this->LOCAL_LANG);
                } else {
                        $HTMLAreaFontSizes[0] = $LANG->getLL('No size');
                }
index 771905e..19a581f 100644 (file)
@@ -84,7 +84,6 @@ class tx_rtehtmlarea_inlineelements extends tx_rtehtmlareaapi {
                'i'             => 'Italic',
                'ins'           => 'Inserted text',
                'kbd'           => 'Keyboard',
-               //'label'               => 'Label',
                'q'             => 'Quotation',
                'samp'          => 'Sample',
                'small'         => 'Small text',
@@ -114,7 +113,6 @@ class tx_rtehtmlarea_inlineelements extends tx_rtehtmlareaapi {
                'insertedtext'  => 'ins',
                'italic'        => 'i',
                'keyboard'      => 'kbd',
-               //'label'               => 'label',
                'monospaced'    => 'tt',
                'quotation'     => 'q',
                'sample'        => 'samp',
@@ -183,7 +181,7 @@ class tx_rtehtmlarea_inlineelements extends tx_rtehtmlareaapi {
                        $inlineElementsOptions = array();
                        foreach ($inlineElementsOrder as $item) {
                                if ($this->htmlAreaRTE->is_FE()) {
-                                       $inlineElementsOptions[$this->buttonToInlineElement[$item]] = $TSFE->csConvObj->conv($TSFE->getLLL($this->defaultInlineElements[$this->buttonToInlineElement[$item]],$this->LOCAL_LANG), $this->htmlAreaRTE->charset, $this->htmlAreaRTE->OutputCharset);
+                                       $inlineElementsOptions[$this->buttonToInlineElement[$item]] = $TSFE->getLLL($this->defaultInlineElements[$this->buttonToInlineElement[$item]], $this->LOCAL_LANG);
                                } else {
                                        $inlineElementsOptions[$this->buttonToInlineElement[$item]] = $LANG->getLL($this->defaultInlineElements[$this->buttonToInlineElement[$item]]);
                                }
index 2bf67bd..c68e2c4 100644 (file)
@@ -52,7 +52,8 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
        var $RTEsetup = array();
        var $thisConfig = array();
        var $confValues;
-       var $language;
+       public $language;
+       public $OutputCharset;
        var $specConf;
        var $LOCAL_LANG;
 
@@ -177,7 +178,7 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                }
                
                        // Character set
-               $this->charset = $TSFE->labelsCharset ? $TSFE->labelsCharset : $TSFE->renderCharset;
+               $this->charset = $TSFE->renderCharset;
                $this->OutputCharset  = $TSFE->metaCharset ? $TSFE->metaCharset : $TSFE->renderCharset;
                
                        // Set the charset of the content