Index: typo3/sysext/t3editor/class.tx_t3editor.php =================================================================== --- typo3/sysext/t3editor/class.tx_t3editor.php (revision 6323) +++ typo3/sysext/t3editor/class.tx_t3editor.php (working copy) @@ -152,6 +152,9 @@ // set correct path to the editor $code.= t3lib_div::wrapJS( + 'var T3editor = T3editor || {};' . + 'T3editor.lang = ' . json_encode($this->getJavaScriptLabels()) .';' . + // TODO namespace all js vars (PATH_t3e, URL_typo3, ...) 'var PATH_t3e = "' . $GLOBALS['BACK_PATH'] . t3lib_extmgm::extRelPath('t3editor') . '"; ' . 'var URL_typo3 = "' . htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir) . '"; ' ); @@ -161,6 +164,46 @@ } /** + * Gets the labels to be used in JavaScript in the Ext JS interface. + * TODO this method is copied from EXT:Recycler, maybe this should be refactored into a helper class + * + * @return array The labels to be used in JavaScript + */ + protected function getJavaScriptLabels() { + $coreLabels = array( + ); + $extensionLabels = $this->getJavaScriptLabelsFromLocallang('js.', 'label_'); + return array_merge($coreLabels, $extensionLabels); + } + + /** + * Gets labels to be used in JavaScript fetched from the current locallang file. + * TODO this method is copied from EXT:Recycler, maybe this should be refactored into a helper class + * + * @param string $selectionPrefix: Prefix to select the correct labels (default: 'js.') + * @param string $stripFromSelectionName: Sub-prefix to be removed from label names in the result (default: '') + * @return array Lables to be used in JavaScript of the current locallang file + * @todo Check, whether this method can be moved in a generic way to $GLOBALS['LANG'] + */ + protected function getJavaScriptLabelsFromLocallang($selectionPrefix = 'js.', $stripFromSelectionName = '') { + $extraction = array(); + $labels = array_merge( + (array)$GLOBALS['LOCAL_LANG']['default'], + (array)$GLOBALS['LOCAL_LANG'][$GLOBALS['LANG']->lang] + ); + // Regular expression to strip the selection prefix and possibly something from the label name: + $labelPattern = '#^' . preg_quote($selectionPrefix, '#') . '(' . preg_quote($stripFromSelectionName, '#') . ')?#'; + // Iterate throuh all locallang lables: + foreach ($labels as $label => $value) { + if (strpos($label, $selectionPrefix) === 0) { + $key = preg_replace($labelPattern, '', $label); + $extraction[$key] = $value; + } + } + return $extraction; + } + + /** * Generates HTML with code editor * * @param string $name Name attribute of HTML tag Index: typo3/sysext/t3editor/jslib/t3editor.js =================================================================== --- typo3/sysext/t3editor/jslib/t3editor.js (revision 6324) +++ typo3/sysext/t3editor/jslib/t3editor.js (working copy) @@ -222,9 +222,10 @@ } this.t3e_statusbar_status.update( - (this.textModified ? ' * ': '') + (this.textModified ? ' * ': '') + bodyContentLineCount - + ' lines'); + + ' ' + + T3editor.lang.lines ); }, updateTextarea: function(event) { @@ -258,7 +259,7 @@ this.textModified = false; this.updateLinenum(); } else { - alert("An error occured while saving the data."); + alert(T3editor.lang.errorWhileSaving); }; this.modalOverlay.hide(); }, Index: typo3/sysext/t3editor/locallang.xml =================================================================== --- typo3/sysext/t3editor/locallang.xml (revision 6315) +++ typo3/sysext/t3editor/locallang.xml (working copy) @@ -15,6 +15,9 @@ + + + \ No newline at end of file