[TASK] Migrate Localization to TypeScript 94/57594/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 13 Jul 2018 20:06:56 +0000 (22:06 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 5 Aug 2018 09:45:46 +0000 (11:45 +0200)
Resolves: #82593
Releases: master
Change-Id: I808d823948a84f6eda1060d46fda4bd93d9bcf0d
Reviewed-on: https://review.typo3.org/57594
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Build/types/TYPO3/index.d.ts
typo3/sysext/backend/Resources/Private/TypeScript/Localization.ts [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/Localization.js

index 189d264..314c6c7 100644 (file)
@@ -30,6 +30,16 @@ declare namespace TYPO3 {
       export class FormEngine {
         public readonly Validation: FormEngineValidation;
       }
+
+      export class Wizard {
+        public addSlide(identifier: string, title: string, content: string, severity: number, callback?: Function): Wizard;
+        public lockNextStep(): JQuery;
+        public unlockNextStep(): JQuery;
+        public getComponent(): JQuery;
+        public addFinalProcessingSlide(callback?: Function): JQueryXHR;
+        public show(): Wizard;
+        public dismiss(): Wizard;
+      }
     }
   }
 }
@@ -49,6 +59,10 @@ declare module 'TYPO3/CMS/Backend/FormEngine' {
   export = new TYPO3.CMS.Backend.FormEngine();
 }
 
+declare module 'TYPO3/CMS/Backend/Wizard' {
+  export = new TYPO3.CMS.Backend.Wizard();
+}
+
 // type definition for global namespace object
 interface Window {
   TYPO3: any;
diff --git a/typo3/sysext/backend/Resources/Private/TypeScript/Localization.ts b/typo3/sysext/backend/Resources/Private/TypeScript/Localization.ts
new file mode 100644 (file)
index 0000000..9013950
--- /dev/null
@@ -0,0 +1,356 @@
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+import {SeverityEnum} from './Enum/Severity';
+import * as $ from 'jquery';
+import Icons = require('./Icons');
+import Wizard = require('TYPO3/CMS/Backend/Wizard');
+
+type LanguageRecord = {
+  uid: number;
+  title: string;
+  flagIcon: string;
+};
+
+type SummaryColumns = {
+  columns: { [key: number]: string };
+  columnList: Array<number>;
+};
+
+type SummaryColPosRecord = {
+  uid: number;
+  title: string;
+  icon: string;
+};
+
+type SummaryRecord = {
+  columns: SummaryColumns;
+  records: Array<Array<SummaryColPosRecord>>;
+};
+
+class Localization {
+  private triggerButton: string = '.t3js-localize';
+  private localizationMode: string = null;
+  private sourceLanguage: number = null;
+  private records: Array<any> = [];
+
+  constructor() {
+    $((): void => {
+      this.initialize();
+    });
+  }
+
+  private initialize(): void {
+    const me = this;
+    Icons.getIcon('actions-localize', Icons.sizes.large).done((localizeIconMarkup: string): void => {
+      Icons.getIcon('actions-edit-copy', Icons.sizes.large).done((copyIconMarkup: string): void => {
+        $(me.triggerButton).removeClass('disabled');
+
+        $(document).on('click', me.triggerButton, (e: JQueryEventObject): void => {
+          e.preventDefault();
+
+          const $triggerButton = $(e.currentTarget);
+          const actions: Array<string> = [];
+          let slideStep1: string = '';
+
+          if ($triggerButton.data('allowTranslate')) {
+            actions.push(
+              '<div class="row">'
+              + '<div class="btn-group col-sm-3">'
+              + '<label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-translate">'
+              + localizeIconMarkup
+              + '<input type="radio" name="mode" id="mode_translate" value="localize" style="display: none">'
+              + '<br>Translate</label>'
+              + '</div>'
+              + '<div class="col-sm-9">'
+              + '<p class="t3js-helptext t3js-helptext-translate text-muted">' + TYPO3.lang['localize.educate.translate'] + '</p>'
+              + '</div>'
+              + '</div>'
+            );
+          }
+
+          if ($triggerButton.data('allowCopy')) {
+            actions.push(
+              '<div class="row">'
+              + '<div class="col-sm-3 btn-group">'
+              + '<label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-copy">'
+              + copyIconMarkup
+              + '<input type="radio" name="mode" id="mode_copy" value="copyFromLanguage" style="display: none">'
+              + '<br>Copy</label>'
+              + '</div>'
+              + '<div class="col-sm-9">'
+              + '<p class="t3js-helptext t3js-helptext-copy text-muted">' + TYPO3.lang['localize.educate.copy'] + '</p>'
+              + '</div>'
+              + '</div>'
+            );
+          }
+
+          slideStep1 += '<div data-toggle="buttons">' + actions.join('<hr>') + '</div>';
+          Wizard.addSlide(
+            'localize-choose-action',
+            TYPO3.lang['localize.wizard.header_page']
+              .replace('{0}', $triggerButton.data('page'))
+              .replace('{1}', $triggerButton.data('languageName')),
+            slideStep1,
+            SeverityEnum.info
+          );
+          Wizard.addSlide(
+            'localize-choose-language',
+            TYPO3.lang['localize.view.chooseLanguage'],
+            '',
+            SeverityEnum.info,
+            ($slide: JQuery): void => {
+              Icons.getIcon('spinner-circle-dark', Icons.sizes.large).done((markup: string): void => {
+                $slide.html('<div class="text-center">' + markup + '</div>');
+
+                this.loadAvailableLanguages(
+                  parseInt($triggerButton.data('pageId'), 10),
+                  parseInt($triggerButton.data('languageId'), 10)
+                ).done((result: Array<LanguageRecord>): void => {
+                  if (result.length === 1) {
+                    // We only have one result, auto select the record and continue
+                    this.sourceLanguage = result[0].uid;
+                    Wizard.unlockNextStep().trigger('click');
+                    return;
+                  }
+
+                  Wizard.getComponent().on('click', '.t3js-language-option', (optionEvt: JQueryEventObject): void => {
+                    const $me = $(optionEvt.currentTarget);
+                    const $radio = $me.find('input[type="radio"]');
+
+                    this.sourceLanguage = $radio.val();
+                    console.log('Localization.ts@132', this.sourceLanguage);
+                    Wizard.unlockNextStep();
+                  });
+
+                  const $languageButtons = $('<div />', {class: 'row', 'data-toggle': 'buttons'});
+
+                  for (const languageObject of result) {
+                    $languageButtons.append(
+                      $('<div />', {class: 'col-sm-4'}).append(
+                        $('<label />', {class: 'btn btn-default btn-block t3js-language-option option'})
+                          .text(' ' + languageObject.title)
+                          .prepend(languageObject.flagIcon)
+                          .prepend(
+                            $('<input />', {
+                              type: 'radio',
+                              name: 'language',
+                              id: 'language' + languageObject.uid,
+                              value: languageObject.uid,
+                              style: 'display: none;'
+                            }
+                          )
+                        )
+                      )
+                    );
+                  }
+                  $slide.empty().append($languageButtons);
+                });
+              });
+            }
+          );
+          Wizard.addSlide(
+            'localize-summary',
+            TYPO3.lang['localize.view.summary'],
+            '',
+            SeverityEnum.info, ($slide: JQuery): void => {
+              Icons.getIcon('spinner-circle-dark', Icons.sizes.large).done((markup: string): void => {
+                $slide.html('<div class="text-center">' + markup + '</div>');
+              });
+              this.getSummary(
+                parseInt($triggerButton.data('pageId'), 10),
+                parseInt($triggerButton.data('languageId'), 10)
+              ).done((result: SummaryRecord): void => {
+                $slide.empty();
+                this.records = [];
+
+                const columns = result.columns.columns;
+                const columnList = result.columns.columnList;
+
+                columnList.forEach((colPos: number): void => {
+                  if (typeof result.records[colPos] === 'undefined') {
+                    return;
+                  }
+
+                  const column = columns[colPos];
+                  const $row = $('<div />', {class: 'row'});
+
+                  result.records[colPos].forEach((record: SummaryColPosRecord): void => {
+                    const label = ' (' + record.uid + ') ' + record.title;
+                    this.records.push(record.uid);
+
+                    $row.append(
+                      $('<div />', {'class': 'col-sm-6'}).append(
+                        $('<div />', {'class': 'input-group'}).append(
+                          $('<span />', {'class': 'input-group-addon'}).append(
+                            $('<input />', {
+                              type: 'checkbox',
+                              'class': 't3js-localization-toggle-record',
+                              id: 'record-uid-' + record.uid,
+                              checked: 'checked',
+                              'data-uid': record.uid,
+                              'aria-label': label
+                            })
+                          ),
+                          $('<label />', {
+                            'class': 'form-control',
+                            for: 'record-uid-' + record.uid
+                          }).text(label).prepend(record.icon)
+                        )
+                      )
+                    );
+                  });
+
+                  $slide.append(
+                    $('<fieldset />', {
+                      'class': 'localization-fieldset'
+                    }).append(
+                      $('<label />').text(column).prepend(
+                        $('<input />', {
+                          'class': 't3js-localization-toggle-column',
+                          type: 'checkbox',
+                          checked: 'checked'
+                        })
+                      ),
+                      $row
+                    )
+                  );
+                });
+
+                Wizard.unlockNextStep();
+
+                Wizard.getComponent().on('change', '.t3js-localization-toggle-record', (cmpEvt: JQueryEventObject): void => {
+                  const $me = $(cmpEvt.currentTarget);
+                  const uid = $me.data('uid');
+                  const $parent = $me.closest('fieldset');
+                  const $columnCheckbox = $parent.find('.t3js-localization-toggle-column');
+
+                  if ($me.is(':checked')) {
+                    this.records.push(uid);
+                  } else {
+                    const index = this.records.indexOf(uid);
+                    if (index > -1) {
+                      this.records.splice(index, 1);
+                    }
+                  }
+
+                  const $allChildren = $parent.find('.t3js-localization-toggle-record');
+                  const $checkedChildren = $parent.find('.t3js-localization-toggle-record:checked');
+
+                  $columnCheckbox.prop('checked', $checkedChildren.length > 0);
+                  $columnCheckbox.prop('indeterminate', $checkedChildren.length > 0 && $checkedChildren.length < $allChildren.length);
+
+                  if (this.records.length > 0) {
+                    Wizard.unlockNextStep();
+                  } else {
+                    Wizard.lockNextStep();
+                  }
+                }).on('change', '.t3js-localization-toggle-column', (toggleEvt): void => {
+                  const $me = $(toggleEvt.currentTarget);
+                  const $children = $me.closest('fieldset').find('.t3js-localization-toggle-record');
+
+                  $children.prop('checked', $me.is(':checked'));
+                  $children.trigger('change');
+                });
+              });
+            }
+          );
+
+          Wizard.addFinalProcessingSlide((): void => {
+            this.localizeRecords(
+              parseInt($triggerButton.data('pageId'), 10),
+              parseInt($triggerButton.data('languageId'), 10),
+              this.records
+            ).done((): void => {
+              Wizard.dismiss();
+              document.location.reload();
+            });
+          }).done((): void => {
+            Wizard.show();
+
+            Wizard.getComponent().on('click', '.t3js-localization-option', (optionEvt: JQueryEventObject): void => {
+              const $me = $(optionEvt.currentTarget);
+              const $radio = $me.find('input[type="radio"]');
+
+              if ($me.data('helptext')) {
+                const $container = $(optionEvt.delegateTarget);
+                $container.find('.t3js-helptext').addClass('text-muted');
+                $container.find($me.data('helptext')).removeClass('text-muted');
+              }
+              this.localizationMode = $radio.val();
+              Wizard.unlockNextStep();
+            });
+          });
+        });
+      });
+    });
+  }
+
+  /**
+   * Load available languages from page
+   *
+   * @param {number} pageId
+   * @param {number} languageId
+   * @returns {JQueryXHR}
+   */
+  private loadAvailableLanguages(pageId: number, languageId: number): JQueryXHR {
+    return $.ajax({
+      url: TYPO3.settings.ajaxUrls.page_languages,
+      data: {
+        pageId: pageId,
+        languageId: languageId
+      }
+    });
+  }
+
+  /**
+   * Get summary for record processing
+   *
+   * @param {number} pageId
+   * @param {number} languageId
+   * @returns {JQueryXHR}
+   */
+  private getSummary(pageId: number, languageId: number): JQueryXHR {
+    return $.ajax({
+      url: TYPO3.settings.ajaxUrls.records_localize_summary,
+      data: {
+        pageId: pageId,
+        destLanguageId: languageId,
+        languageId: this.sourceLanguage
+      }
+    });
+  }
+
+  /**
+   * Localize records
+   *
+   * @param {number} pageId
+   * @param {number} languageId
+   * @param {Array<number>} uidList
+   * @returns {JQueryXHR}
+   */
+  private localizeRecords(pageId: number, languageId: number, uidList: Array<number>): JQueryXHR {
+    return $.ajax({
+      url: TYPO3.settings.ajaxUrls.records_localize,
+      data: {
+        pageId: pageId,
+        srcLanguageId: this.sourceLanguage,
+        destLanguageId: languageId,
+        action: this.localizationMode,
+        uidList: uidList
+      }
+    });
+  }
+}
+
+export = new Localization();
index 9312fa1..83fedb4 100644 (file)
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-/**
- * Module: TYPO3/CMS/Backend/Localization
- * UI for localization workflow.
- */
-define([
-  'jquery',
-  'TYPO3/CMS/Backend/AjaxDataHandler',
-  'TYPO3/CMS/Backend/Wizard',
-  'TYPO3/CMS/Backend/Icons',
-  'TYPO3/CMS/Backend/Severity',
-  'bootstrap'
-], function($, DataHandler, Wizard, Icons, Severity) {
-  'use strict';
-
-  /**
-   * @type {{identifier: {triggerButton: string}, actions: {translate: $, copy: $}, settings: {}, records: []}}
-   * @exports TYPO3/CMS/Backend/Localization
-   */
-  var Localization = {
-    identifier: {
-      triggerButton: '.t3js-localize'
-    },
-    actions: {
-      translate: $('<label />', {
-        class: 'btn btn-block btn-default t3js-option',
-        'data-helptext': '.t3js-helptext-translate'
-      }).html('<br>Translate').prepend(
-        $('<input />', {
-          type: 'radio',
-          name: 'mode',
-          id: 'mode_translate',
-          value: 'localize',
-          style: 'display: none'
-        })
-      ),
-      copy: $('<label />', {
-        class: 'btn btn-block btn-default t3js-option',
-        'data-helptext': '.t3js-helptext-copy'
-      }).html('<br>Copy').prepend(
-        $('<input />', {
-          type: 'radio',
-          name: 'mode',
-          id: 'mode_copy',
-          value: 'copyFromLanguage',
-          style: 'display: none'
-        })
-      )
-    },
-    settings: {},
-    records: []
-  };
-
-  Localization.initialize = function() {
-    Icons.getIcon('actions-localize', Icons.sizes.large).done(function(localizeIconMarkup) {
-      Icons.getIcon('actions-edit-copy', Icons.sizes.large).done(function(copyIconMarkup) {
-        Localization.actions.translate.prepend(localizeIconMarkup);
-        Localization.actions.copy.prepend(copyIconMarkup);
-        $(Localization.identifier.triggerButton).removeClass('disabled');
-      });
-    });
-
-    $(document).on('click', Localization.identifier.triggerButton, function(e) {
-      e.preventDefault();
-
-      var $triggerButton = $(this),
-        actions = [],
-        slideStep1 = '';
-
-      if ($triggerButton.data('allowTranslate')) {
-        actions.push(
-          '<div class="row">'
-          + '<div class="btn-group col-sm-3">' + Localization.actions.translate[0].outerHTML + '</div>'
-          + '<div class="col-sm-9">'
-          + '<p class="t3js-helptext t3js-helptext-translate text-muted">' + TYPO3.lang['localize.educate.translate'] + '</p>'
-          + '</div>'
-          + '</div>'
-        );
-      }
-
-      if ($triggerButton.data('allowCopy')) {
-        actions.push(
-          '<div class="row">'
-          + '<div class="col-sm-3 btn-group">' + Localization.actions.copy[0].outerHTML + '</div>'
-          + '<div class="col-sm-9">'
-          + '<p class="t3js-helptext t3js-helptext-copy text-muted">' + TYPO3.lang['localize.educate.copy'] + '</p>'
-          + '</div>'
-          + '</div>'
-        );
-      }
-
-      slideStep1 += '<div data-toggle="buttons">' + actions.join('<hr>') + '</div>';
-
-      Wizard.addSlide('localize-choose-action', TYPO3.lang['localize.wizard.header_page'].replace('{0}', $triggerButton.data('page')).replace('{1}', $triggerButton.data('languageName')), slideStep1, Severity.info);
-      Wizard.addSlide('localize-choose-language', TYPO3.lang['localize.view.chooseLanguage'], '', Severity.info, function($slide) {
-        Icons.getIcon('spinner-circle-dark', Icons.sizes.large).done(function(markup) {
-          $slide.html(
-            $('<div />', {class: 'text-center'}).append(markup)
-          );
-          Localization.loadAvailableLanguages(
-            $triggerButton.data('pageId'),
-            $triggerButton.data('languageId')
-          ).done(function(result) {
-            if (result.length === 1) {
-              // We only have one result, auto select the record and continue
-              Localization.settings.language = result[0].uid + ''; // we need a string
-              Wizard.unlockNextStep().trigger('click');
-              return;
-            }
-
-            var $languageButtons = $('<div />', {class: 'row', 'data-toggle': 'buttons'});
-
-            $.each(result, function(_, languageObject) {
-              $languageButtons.append(
-                $('<div />', {class: 'col-sm-4'}).append(
-                  $('<label />', {class: 'btn btn-default btn-block t3js-option option'}).text(' ' + languageObject.title).prepend(
-                    languageObject.flagIcon
-                  ).prepend(
-                    $('<input />', {
-                      type: 'radio',
-                      name: 'language',
-                      id: 'language' + languageObject.uid,
-                      value: languageObject.uid,
-                      style: 'display: none;'
-                    })
-                  )
-                )
-              );
-            });
-            $slide.html($languageButtons);
-          });
-        });
-      });
-      Wizard.addSlide('localize-summary', TYPO3.lang['localize.view.summary'], '', Severity.info, function($slide) {
-        Icons.getIcon('spinner-circle-dark', Icons.sizes.large).done(function(markup) {
-          $slide.html(
-            $('<div />', {class: 'text-center'}).append(markup)
-          );
-          Localization.getSummary(
-            $triggerButton.data('pageId'),
-            $triggerButton.data('languageId')
-          ).done(function(result) {
-            $slide.empty();
-            Localization.records = [];
-
-            var columns = result.columns.columns;
-            var columnList = result.columns.columnList;
-
-            columnList.forEach(function(colPos) {
-              if (typeof result.records[colPos] === 'undefined') {
-                return;
-              }
-
-              var column = columns[colPos];
-              var $row = $('<div />', {class: 'row'});
-
-              result.records[colPos].forEach(function(record) {
-                var label = ' (' + record.uid + ') ' + record.title;
-                Localization.records.push(record.uid);
-
-                $row.append(
-                  $('<div />', {'class': 'col-sm-6'}).append(
-                    $('<div />', {'class': 'input-group'}).append(
-                      $('<span />', {'class': 'input-group-addon'}).append(
-                        $('<input />', {
-                          type: 'checkbox',
-                          'class': 't3js-localization-toggle-record',
-                          id: 'record-uid-' + record.uid,
-                          checked: 'checked',
-                          'data-uid': record.uid,
-                          'aria-label': label
-                        })
-                      ),
-                      $('<label />', {
-                        'class': 'form-control',
-                        for: 'record-uid-' + record.uid
-                      }).text(label).prepend(record.icon)
-                    )
-                  )
-                );
-              });
-
-              $slide.append(
-                $('<fieldset />', {
-                  'class': 'localization-fieldset'
-                }).append(
-                  $('<label />').text(column).prepend(
-                    $('<input />', {
-                      'class': 't3js-localization-toggle-column',
-                      type: 'checkbox',
-                      checked: 'checked'
-                    })
-                  ),
-                  $row
-                )
-              );
-            });
-            Wizard.unlockNextStep();
-
-            Wizard.getComponent().on('change', '.t3js-localization-toggle-record', function() {
-              var $me = $(this),
-                uid = $me.data('uid'),
-                $parent = $me.closest('fieldset'),
-                $columnCheckbox = $parent.find('.t3js-localization-toggle-column');
-
-              if ($me.is(':checked')) {
-                Localization.records.push(uid);
-              } else {
-                var index = Localization.records.indexOf(uid);
-                if (index > -1) {
-                  Localization.records.splice(index, 1);
-                }
-              }
-
-              var $allChildren = $parent.find('.t3js-localization-toggle-record');
-              var $checkedChildren = $parent.find('.t3js-localization-toggle-record:checked');
-
-              $columnCheckbox.prop('checked', $checkedChildren.length > 0);
-              $columnCheckbox.prop('indeterminate', $checkedChildren.length > 0 && $checkedChildren.length < $allChildren.length);
-
-              if (Localization.records.length > 0) {
-                Wizard.unlockNextStep();
-              } else {
-                Wizard.lockNextStep();
-              }
-            }).on('change', '.t3js-localization-toggle-column', function() {
-              var $me = $(this),
-                $children = $me.closest('fieldset').find('.t3js-localization-toggle-record');
-
-              $children.prop('checked', $me.is(':checked'));
-              $children.trigger('change');
-            });
-          });
-        });
-      });
-      Wizard.addFinalProcessingSlide(function() {
-        Localization.localizeRecords(
-          $triggerButton.data('pageId'),
-          $triggerButton.data('languageId'),
-          Localization.records
-        ).done(function() {
-          Wizard.dismiss();
-          document.location.reload();
-        });
-      }).done(function() {
-        Wizard.show();
-
-        Wizard.getComponent().on('click', '.t3js-option', function(e) {
-          var $me = $(this),
-            $radio = $me.find('input[type="radio"]');
-
-          if ($me.data('helptext')) {
-            var $container = $(e.delegateTarget);
-            $container.find('.t3js-helptext').addClass('text-muted');
-            $container.find($me.data('helptext')).removeClass('text-muted');
-          }
-          if ($radio.length > 0) {
-            Localization.settings[$radio.attr('name')] = $radio.val();
-          }
-          Wizard.unlockNextStep();
-        });
-      });
-    });
-
-    /**
-     * Load available languages from page
-     *
-     * @param {Integer} pageId
-     * @param {Integer} languageId
-     * @return {Promise}
-     */
-    Localization.loadAvailableLanguages = function(pageId, languageId) {
-      return $.ajax({
-        url: TYPO3.settings.ajaxUrls['page_languages'],
-        data: {
-          pageId: pageId,
-          languageId: languageId
-        }
-      });
-    };
-
-    /**
-     * Get summary for record processing
-     *
-     * @param {Integer} pageId
-     * @param {Integer} languageId
-     * @return {Promise}
-     */
-    Localization.getSummary = function(pageId, languageId) {
-      return $.ajax({
-        url: TYPO3.settings.ajaxUrls['records_localize_summary'],
-        data: {
-          pageId: pageId,
-          destLanguageId: languageId,
-          languageId: Localization.settings.language
-        }
-      });
-    };
-
-    /**
-     * Localize records
-     *
-     * @param {Integer} pageId
-     * @param {Integer} languageId
-     * @param {Array} uidList
-     * @return {Promise}
-     */
-    Localization.localizeRecords = function(pageId, languageId, uidList) {
-      return $.ajax({
-        url: TYPO3.settings.ajaxUrls['records_localize'],
-        data: {
-          pageId: pageId,
-          srcLanguageId: Localization.settings.language,
-          destLanguageId: languageId,
-          action: Localization.settings.mode,
-          uidList: uidList
-        }
-      });
-    };
-  };
-
-  $(Localization.initialize);
-
-  return Localization;
-});
+var __values=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],a=0;return t?t.call(e):{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}}};define(["require","exports","./Enum/Severity","jquery","./Icons","TYPO3/CMS/Backend/Wizard"],function(e,t,a,n,o,l){"use strict";return new(function(){function e(){var e=this;this.triggerButton=".t3js-localize",this.localizationMode=null,this.sourceLanguage=null,this.records=[],n(function(){e.initialize()})}return e.prototype.initialize=function(){var e=this,t=this;o.getIcon("actions-localize",o.sizes.large).done(function(i){o.getIcon("actions-edit-copy",o.sizes.large).done(function(c){n(t.triggerButton).removeClass("disabled"),n(document).on("click",t.triggerButton,function(t){t.preventDefault();var r=n(t.currentTarget),d=[],s="";r.data("allowTranslate")&&d.push('<div class="row"><div class="btn-group col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-translate">'+i+'<input type="radio" name="mode" id="mode_translate" value="localize" style="display: none"><br>Translate</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-translate text-muted">'+TYPO3.lang["localize.educate.translate"]+"</p></div></div>"),r.data("allowCopy")&&d.push('<div class="row"><div class="col-sm-3 btn-group"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-copy">'+c+'<input type="radio" name="mode" id="mode_copy" value="copyFromLanguage" style="display: none"><br>Copy</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-copy text-muted">'+TYPO3.lang["localize.educate.copy"]+"</p></div></div>"),s+='<div data-toggle="buttons">'+d.join("<hr>")+"</div>",l.addSlide("localize-choose-action",TYPO3.lang["localize.wizard.header_page"].replace("{0}",r.data("page")).replace("{1}",r.data("languageName")),s,a.SeverityEnum.info),l.addSlide("localize-choose-language",TYPO3.lang["localize.view.chooseLanguage"],"",a.SeverityEnum.info,function(t){o.getIcon("spinner-circle-dark",o.sizes.large).done(function(a){t.html('<div class="text-center">'+a+"</div>"),e.loadAvailableLanguages(parseInt(r.data("pageId"),10),parseInt(r.data("languageId"),10)).done(function(a){if(1===a.length)return e.sourceLanguage=a[0].uid,void l.unlockNextStep().trigger("click");l.getComponent().on("click",".t3js-language-option",function(t){var a=n(t.currentTarget).find('input[type="radio"]');e.sourceLanguage=a.val(),console.log("Localization.ts@132",e.sourceLanguage),l.unlockNextStep()});var o,i,c=n("<div />",{class:"row","data-toggle":"buttons"});try{for(var r=__values(a),d=r.next();!d.done;d=r.next()){var s=d.value;c.append(n("<div />",{class:"col-sm-4"}).append(n("<label />",{class:"btn btn-default btn-block t3js-language-option option"}).text(" "+s.title).prepend(s.flagIcon).prepend(n("<input />",{type:"radio",name:"language",id:"language"+s.uid,value:s.uid,style:"display: none;"}))))}}catch(e){o={error:e}}finally{try{d&&!d.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}t.empty().append(c)})})}),l.addSlide("localize-summary",TYPO3.lang["localize.view.summary"],"",a.SeverityEnum.info,function(t){o.getIcon("spinner-circle-dark",o.sizes.large).done(function(e){t.html('<div class="text-center">'+e+"</div>")}),e.getSummary(parseInt(r.data("pageId"),10),parseInt(r.data("languageId"),10)).done(function(a){t.empty(),e.records=[];var o=a.columns.columns;a.columns.columnList.forEach(function(l){if(void 0!==a.records[l]){var i=o[l],c=n("<div />",{class:"row"});a.records[l].forEach(function(t){var a=" ("+t.uid+") "+t.title;e.records.push(t.uid),c.append(n("<div />",{class:"col-sm-6"}).append(n("<div />",{class:"input-group"}).append(n("<span />",{class:"input-group-addon"}).append(n("<input />",{type:"checkbox",class:"t3js-localization-toggle-record",id:"record-uid-"+t.uid,checked:"checked","data-uid":t.uid,"aria-label":a})),n("<label />",{class:"form-control",for:"record-uid-"+t.uid}).text(a).prepend(t.icon))))}),t.append(n("<fieldset />",{class:"localization-fieldset"}).append(n("<label />").text(i).prepend(n("<input />",{class:"t3js-localization-toggle-column",type:"checkbox",checked:"checked"})),c))}}),l.unlockNextStep(),l.getComponent().on("change",".t3js-localization-toggle-record",function(t){var a=n(t.currentTarget),o=a.data("uid"),i=a.closest("fieldset"),c=i.find(".t3js-localization-toggle-column");if(a.is(":checked"))e.records.push(o);else{var r=e.records.indexOf(o);r>-1&&e.records.splice(r,1)}var d=i.find(".t3js-localization-toggle-record"),s=i.find(".t3js-localization-toggle-record:checked");c.prop("checked",s.length>0),c.prop("indeterminate",s.length>0&&s.length<d.length),e.records.length>0?l.unlockNextStep():l.lockNextStep()}).on("change",".t3js-localization-toggle-column",function(e){var t=n(e.currentTarget),a=t.closest("fieldset").find(".t3js-localization-toggle-record");a.prop("checked",t.is(":checked")),a.trigger("change")})})}),l.addFinalProcessingSlide(function(){e.localizeRecords(parseInt(r.data("pageId"),10),parseInt(r.data("languageId"),10),e.records).done(function(){l.dismiss(),document.location.reload()})}).done(function(){l.show(),l.getComponent().on("click",".t3js-localization-option",function(t){var a=n(t.currentTarget),o=a.find('input[type="radio"]');if(a.data("helptext")){var i=n(t.delegateTarget);i.find(".t3js-helptext").addClass("text-muted"),i.find(a.data("helptext")).removeClass("text-muted")}e.localizationMode=o.val(),l.unlockNextStep()})})})})})},e.prototype.loadAvailableLanguages=function(e,t){return n.ajax({url:TYPO3.settings.ajaxUrls.page_languages,data:{pageId:e,languageId:t}})},e.prototype.getSummary=function(e,t){return n.ajax({url:TYPO3.settings.ajaxUrls.records_localize_summary,data:{pageId:e,destLanguageId:t,languageId:this.sourceLanguage}})},e.prototype.localizeRecords=function(e,t,a){return n.ajax({url:TYPO3.settings.ajaxUrls.records_localize,data:{pageId:e,srcLanguageId:this.sourceLanguage,destLanguageId:t,action:this.localizationMode,uidList:a}})},e}())});
\ No newline at end of file