[TASK] Use TYPO3.l10n API for JS localizations
authorTolleiv Nietsch <info@tolleiv.de>
Mon, 29 Aug 2011 20:45:23 +0000 (22:45 +0200)
committerTolleiv Nietsch <info@tolleiv.de>
Mon, 29 Aug 2011 20:45:23 +0000 (22:45 +0200)
We haven't used the localization API within the JS
layer so far - this patch changes it ;)

Change-Id: I05781b89e29f0ebdd4b811268507cfc47bd75755
Resolves: #29333
Branches: 4.6

typo3/sysext/workspaces/Classes/Controller/PreviewController.php
typo3/sysext/workspaces/Resources/Public/JavaScript/actions.js
typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js

index 90e6d6a..e3809fd 100644 (file)
@@ -163,9 +163,10 @@ class Tx_Workspaces_Controller_PreviewController extends Tx_Workspaces_Controlle
                $this->pageRenderer->addInlineSetting('Workspaces', 'disableNextStageButton', $this->isInvalidStage($nextStage));
                $this->pageRenderer->addInlineSetting('Workspaces', 'disablePreviousStageButton', $this->isInvalidStage($previousStage));
                $this->pageRenderer->addInlineSetting('Workspaces', 'disableDiscardStageButton', $this->isInvalidStage($nextStage) && $this->isInvalidStage($previousStage));
-
+               $resourcePath = t3lib_extMgm::extRelPath('lang') . 'res/js/be/';
+               $this->pageRenderer->addJsFile($resourcePath . 'typo3lang.js');
                $this->pageRenderer->addJsInlineCode("workspaces.preview.lll", "
-               TYPO3.LLL.Workspaces = {
+               TYPO3.lang = {
                        visualPreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.visualPreview', TRUE) . "',
                        listView: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.listView', TRUE) . "',
                        livePreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.livePreview', TRUE) . "',
@@ -178,7 +179,7 @@ class Tx_Workspaces_Controller_PreviewController extends Tx_Workspaces_Controlle
                        discard: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:label_doaction_discard', TRUE) . "',
                        nextStage: '" . $nextStage['title'] . "',
                        previousStage: '" . $previousStage['title'] . "'
-               };\n");
+               };TYPO3.l10n.initialize();\n");
 
                $resourcePath = t3lib_extMgm::extRelPath('workspaces') . 'Resources/Public/';
                $this->pageRenderer->addJsFile($resourcePath . 'JavaScript/preview.js');
index 500825a..8235600 100644 (file)
@@ -218,7 +218,7 @@ TYPO3.Workspaces.Actions = {
                                TYPO3.Workspaces.Actions.handlerResponseOnExecuteAction(response);
                        } else {
                                var dialog = TYPO3.Workspaces.Helpers.getSendToStageWindow({
-                                       title: TYPO3.LLL.Workspaces.nextStage,
+                                       title: TYPO3.l10n.localize('nextStage'),
                                        items: response.items.items,
                                        executeHandler: function(event) {
                                                var values = top.Ext.getCmp('sendToStageForm').getForm().getValues();
@@ -262,7 +262,7 @@ TYPO3.Workspaces.Actions = {
                                TYPO3.Workspaces.Actions.handlerResponseOnExecuteAction(response);
                        } else {
                                var dialog = TYPO3.Workspaces.Helpers.getSendToStageWindow({
-                                       title: TYPO3.LLL.Workspaces.nextStage,
+                                       title: TYPO3.l10n.localize('nextStage'),
                                        items: response.items.items,
                                        executeHandler: function(event) {
                                                var values = top.Ext.getCmp('sendToStageForm').getForm().getValues();
index 69ac2e0..0b1a66a 100644 (file)
@@ -68,8 +68,8 @@ Ext.onReady(function() {
                                                                        xtype: 'button',
                                                                        id: 'sizeSliderButtonLive',
                                                                        cls: 'sliderButton',
-                                                                       text: TYPO3.LLL.Workspaces.livePreview,
-                                                                       tooltip: TYPO3.LLL.Workspaces.livePreviewDetail,
+                                                                       text: TYPO3.l10n.localize('livePreview'),
+                                                                       tooltip: TYPO3.l10n.localize('livePreviewDetail'),
                                                                        width: 100,
                                                                        listeners: {
                                                                                click: {
@@ -102,8 +102,8 @@ Ext.onReady(function() {
                                                                        xtype: 'button',
                                                                        id: 'sizeSliderButtonWorkspace',
                                                                        cls: 'sliderButton',
-                                                                       text: TYPO3.LLL.Workspaces.workspacePreview,
-                                                                       tooltip: TYPO3.LLL.Workspaces.workspacePreviewDetail,
+                                                                       text: TYPO3.l10n.localize('workspacePreview'),
+                                                                       tooltip: TYPO3.l10n.localize('workspacePreviewDetail'),
                                                                        width: 100,
                                                                        listeners: {
                                                                                click: {
@@ -121,7 +121,7 @@ Ext.onReady(function() {
                                                columns: 4,
                                                width: 400,
                                                items: [{
-                                                       text: TYPO3.LLL.Workspaces.nextStage,
+                                                       text: TYPO3.l10n.localize('nextStage'),
                                                        xtype: 'button',
                                                        iconCls: 'x-btn-text',
                                                        id: 'feToolbarButtonNextStage',
@@ -134,7 +134,7 @@ Ext.onReady(function() {
                                                                }
                                                        }
                                                }, {
-                                                       text: TYPO3.LLL.Workspaces.previousStage,
+                                                       text: TYPO3.l10n.localize('previousStage'),
                                                        xtype: 'button',
                                                        iconCls: 'x-btn-text',
                                                        id: 'feToolbarButtonPreviousStage',
@@ -147,7 +147,7 @@ Ext.onReady(function() {
                                                                }
                                                        }
                                                }, {
-                                                       text: TYPO3.LLL.Workspaces.discard,
+                                                       text: TYPO3.l10n.localize('discard'),
                                                        iconCls: 'x-btn-text',
                                                        xtype: 'button',
                                                        id: 'feToolbarButtonDiscardStage',
@@ -169,14 +169,14 @@ Ext.onReady(function() {
                                                                stateId: 'WorkspacePreviewModeSelect',
                                                                stateEvents: ['itemclick'],
                                                                items: [{
-                                                                       text: TYPO3.LLL.Workspaces.modeSlider,
+                                                                       text: TYPO3.l10n.localize('modeSlider'),
                                                                        id: 'visual-mode-selector-slider',
                                                                        checked: false,
                                                                        group: 'mode',
                                                                        hidden: TYPO3.settings.Workspaces.SplitPreviewModes.indexOf('slider') == -1,
                                                                        checkHandler: modeChange
                                                                },{
-                                                                       text: TYPO3.LLL.Workspaces.modeVbox,
+                                                                       text: TYPO3.l10n.localize('modeVbox'),
                                                                        id: 'visual-mode-selector-vbox',
                                                                        checked: false,
                                                                        group: 'mode',
@@ -184,7 +184,7 @@ Ext.onReady(function() {
                                                                        checkHandler: modeChange
 
                                                                },{
-                                                                       text: TYPO3.LLL.Workspaces.modeHbox,
+                                                                       text: TYPO3.l10n.localize('modeHbox'),
                                                                        id: 'visual-mode-selector-hbox',
                                                                        checked: false,
                                                                        group: 'mode',
@@ -204,7 +204,7 @@ Ext.onReady(function() {
                                ]
                        }],
                        items: [{
-                               title: TYPO3.LLL.Workspaces.visualPreview,
+                               title: TYPO3.l10n.localize('visualPreview'),
                                id: 'wsVisual',
                                layout: 'fit',
                                anchor: '100% 100%',
@@ -317,7 +317,7 @@ Ext.onReady(function() {
                                        }]
                                }]
                        },{
-                               title: TYPO3.LLL.Workspaces.listView,
+                               title: TYPO3.l10n.localize('listView'),
                                id: 'wsSettings',
                                layout: 'fit',
                                listeners: {