Commit 52bd2fcb authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Make translation mode buttons translatable

The translation mode buttons in the localization
wizard are now translatable as the rest of the
wizard.

Resolves: #94277
Releases: master, 10.4
Change-Id: Ie2bbaebbcf5c701a8e3446a3406dece565c2013b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69405

Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
parent bcf1e1ec
......@@ -72,7 +72,7 @@ class Localization {
+ '<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>'
+ '<br>' + TYPO3.lang['localize.wizard.button.translate'] + '</label>'
+ '</div>'
+ '<div class="col-sm-9">'
+ '<p class="t3js-helptext t3js-helptext-translate text-muted">' + TYPO3.lang['localize.educate.translate'] + '</p>'
......@@ -88,7 +88,7 @@ class Localization {
+ '<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>'
+ '<br>' + TYPO3.lang['localize.wizard.button.copy'] + '</label>'
+ '</div>'
+ '<div class="col-sm-9">'
+ '<p class="t3js-helptext t3js-helptext-copy text-muted">' + TYPO3.lang['localize.educate.copy'] + '</p>'
......
......@@ -339,6 +339,12 @@
<trans-unit id="localize.wizard.header_page" resname="localize.wizard.header_page">
<source>Localize page &quot;{0}&quot; into {1}</source>
</trans-unit>
<trans-unit id="localize.wizard.button.translate" resname="localize.wizard.button.translate">
<source>Translate</source>
</trans-unit>
<trans-unit id="localize.wizard.button.copy" resname="localize.wizard.button.copy">
<source>Copy</source>
</trans-unit>
<trans-unit id="localize.wizard.button.cancel" resname="localize.wizard.button.cancel">
<source>Cancel</source>
</trans-unit>
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","./Enum/Severity","TYPO3/CMS/Core/Ajax/AjaxRequest","./Icons","./Wizard"],(function(e,t,a,l,s,i,o){"use strict";a=__importDefault(a);return new class{constructor(){this.triggerButton=".t3js-localize",this.localizationMode=null,this.sourceLanguage=null,this.records=[],a.default(()=>{this.initialize()})}initialize(){const e=this;i.getIcon("actions-localize",i.sizes.large).then(t=>{i.getIcon("actions-edit-copy",i.sizes.large).then(s=>{a.default(e.triggerButton).removeClass("disabled"),a.default(document).on("click",e.triggerButton,e=>{e.preventDefault();const n=a.default(e.currentTarget),d=[];let c="";n.data("allowTranslate")&&d.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-translate">'+t+'<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>"),n.data("allowCopy")&&d.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-copy">'+s+'<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>"),0===n.data("allowTranslate")&&0===n.data("allowCopy")&&d.push('<div class="row"><div class="col-sm-12"><div class="alert alert-warning"><div class="media"><div class="media-left"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-exclamation fa-stack-1x"></i></span></div><div class="media-body"><p class="alert-message">'+TYPO3.lang["localize.educate.noTranslate"]+"</p></div></div></div></div></div>"),c+='<div data-bs-toggle="buttons">'+d.join("<hr>")+"</div>",o.addSlide("localize-choose-action",TYPO3.lang["localize.wizard.header_page"].replace("{0}",n.data("page")).replace("{1}",n.data("languageName")),c,l.SeverityEnum.info),o.addSlide("localize-choose-language",TYPO3.lang["localize.view.chooseLanguage"],"",l.SeverityEnum.info,e=>{i.getIcon("spinner-circle-dark",i.sizes.large).then(t=>{e.html('<div class="text-center">'+t+"</div>"),this.loadAvailableLanguages(parseInt(n.data("pageId"),10),parseInt(n.data("languageId"),10)).then(async t=>{const l=await t.resolve();if(1===l.length)return this.sourceLanguage=l[0].uid,void o.unlockNextStep().trigger("click");o.getComponent().on("click",".t3js-language-option",e=>{const t=a.default(e.currentTarget).find('input[type="radio"]');this.sourceLanguage=t.val(),console.log("Localization.ts@132",this.sourceLanguage),o.unlockNextStep()});const s=a.default("<div />",{class:"row","data-bs-toggle":"buttons"});for(const e of l)s.append(a.default("<div />",{class:"col-sm-4"}).append(a.default("<label />",{class:"btn btn-default btn-block t3js-language-option option"}).text(" "+e.title).prepend(e.flagIcon).prepend(a.default("<input />",{type:"radio",name:"language",id:"language"+e.uid,value:e.uid,style:"display: none;"}))));e.empty().append(s)})})}),o.addSlide("localize-summary",TYPO3.lang["localize.view.summary"],"",l.SeverityEnum.info,e=>{i.getIcon("spinner-circle-dark",i.sizes.large).then(t=>{e.html('<div class="text-center">'+t+"</div>")}),this.getSummary(parseInt(n.data("pageId"),10),parseInt(n.data("languageId"),10)).then(async t=>{const l=await t.resolve();e.empty(),this.records=[];const s=l.columns.columns;l.columns.columnList.forEach(t=>{if(void 0===l.records[t])return;const i=s[t],o=a.default("<div />",{class:"row"});l.records[t].forEach(e=>{const t=" ("+e.uid+") "+e.title;this.records.push(e.uid),o.append(a.default("<div />",{class:"col-sm-6"}).append(a.default("<div />",{class:"input-group"}).append(a.default("<span />",{class:"input-group-addon"}).append(a.default("<input />",{type:"checkbox",class:"t3js-localization-toggle-record",id:"record-uid-"+e.uid,checked:"checked","data-uid":e.uid,"aria-label":t})),a.default("<label />",{class:"form-control",for:"record-uid-"+e.uid}).text(t).prepend(e.icon))))}),e.append(a.default("<fieldset />",{class:"localization-fieldset"}).append(a.default("<label />").text(i).prepend(a.default("<input />",{class:"t3js-localization-toggle-column",type:"checkbox",checked:"checked"})),o))}),o.unlockNextStep(),o.getComponent().on("change",".t3js-localization-toggle-record",e=>{const t=a.default(e.currentTarget),l=t.data("uid"),s=t.closest("fieldset"),i=s.find(".t3js-localization-toggle-column");if(t.is(":checked"))this.records.push(l);else{const e=this.records.indexOf(l);e>-1&&this.records.splice(e,1)}const n=s.find(".t3js-localization-toggle-record"),d=s.find(".t3js-localization-toggle-record:checked");i.prop("checked",d.length>0),i.prop("indeterminate",d.length>0&&d.length<n.length),this.records.length>0?o.unlockNextStep():o.lockNextStep()}).on("change",".t3js-localization-toggle-column",e=>{const t=a.default(e.currentTarget),l=t.closest("fieldset").find(".t3js-localization-toggle-record");l.prop("checked",t.is(":checked")),l.trigger("change")})})}),o.addFinalProcessingSlide(()=>{this.localizeRecords(parseInt(n.data("pageId"),10),parseInt(n.data("languageId"),10),this.records).then(()=>{o.dismiss(),document.location.reload()})}).then(()=>{o.show(),o.getComponent().on("click",".t3js-localization-option",e=>{const t=a.default(e.currentTarget),l=t.find('input[type="radio"]');if(t.data("helptext")){const l=a.default(e.delegateTarget);l.find(".t3js-localization-option").removeClass("active"),l.find(".t3js-helptext").addClass("text-muted"),t.addClass("active"),l.find(t.data("helptext")).removeClass("text-muted")}this.localizationMode=l.val(),o.unlockNextStep()})})})})})}loadAvailableLanguages(e,t){return new s(TYPO3.settings.ajaxUrls.page_languages).withQueryArguments({pageId:e,languageId:t}).get()}getSummary(e,t){return new s(TYPO3.settings.ajaxUrls.records_localize_summary).withQueryArguments({pageId:e,destLanguageId:t,languageId:this.sourceLanguage}).get()}localizeRecords(e,t,a){return new s(TYPO3.settings.ajaxUrls.records_localize).withQueryArguments({pageId:e,srcLanguageId:this.sourceLanguage,destLanguageId:t,action:this.localizationMode,uidList:a}).get()}}}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","./Enum/Severity","TYPO3/CMS/Core/Ajax/AjaxRequest","./Icons","./Wizard"],(function(e,t,a,l,s,i,o){"use strict";a=__importDefault(a);return new class{constructor(){this.triggerButton=".t3js-localize",this.localizationMode=null,this.sourceLanguage=null,this.records=[],a.default(()=>{this.initialize()})}initialize(){const e=this;i.getIcon("actions-localize",i.sizes.large).then(t=>{i.getIcon("actions-edit-copy",i.sizes.large).then(s=>{a.default(e.triggerButton).removeClass("disabled"),a.default(document).on("click",e.triggerButton,e=>{e.preventDefault();const n=a.default(e.currentTarget),d=[];let c="";n.data("allowTranslate")&&d.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-translate">'+t+'<input type="radio" name="mode" id="mode_translate" value="localize" style="display: none"><br>'+TYPO3.lang["localize.wizard.button.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>"),n.data("allowCopy")&&d.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-copy">'+s+'<input type="radio" name="mode" id="mode_copy" value="copyFromLanguage" style="display: none"><br>'+TYPO3.lang["localize.wizard.button.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>"),0===n.data("allowTranslate")&&0===n.data("allowCopy")&&d.push('<div class="row"><div class="col-sm-12"><div class="alert alert-warning"><div class="media"><div class="media-left"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-exclamation fa-stack-1x"></i></span></div><div class="media-body"><p class="alert-message">'+TYPO3.lang["localize.educate.noTranslate"]+"</p></div></div></div></div></div>"),c+='<div data-bs-toggle="buttons">'+d.join("<hr>")+"</div>",o.addSlide("localize-choose-action",TYPO3.lang["localize.wizard.header_page"].replace("{0}",n.data("page")).replace("{1}",n.data("languageName")),c,l.SeverityEnum.info),o.addSlide("localize-choose-language",TYPO3.lang["localize.view.chooseLanguage"],"",l.SeverityEnum.info,e=>{i.getIcon("spinner-circle-dark",i.sizes.large).then(t=>{e.html('<div class="text-center">'+t+"</div>"),this.loadAvailableLanguages(parseInt(n.data("pageId"),10),parseInt(n.data("languageId"),10)).then(async t=>{const l=await t.resolve();if(1===l.length)return this.sourceLanguage=l[0].uid,void o.unlockNextStep().trigger("click");o.getComponent().on("click",".t3js-language-option",e=>{const t=a.default(e.currentTarget).find('input[type="radio"]');this.sourceLanguage=t.val(),console.log("Localization.ts@132",this.sourceLanguage),o.unlockNextStep()});const s=a.default("<div />",{class:"row","data-bs-toggle":"buttons"});for(const e of l)s.append(a.default("<div />",{class:"col-sm-4"}).append(a.default("<label />",{class:"btn btn-default btn-block t3js-language-option option"}).text(" "+e.title).prepend(e.flagIcon).prepend(a.default("<input />",{type:"radio",name:"language",id:"language"+e.uid,value:e.uid,style:"display: none;"}))));e.empty().append(s)})})}),o.addSlide("localize-summary",TYPO3.lang["localize.view.summary"],"",l.SeverityEnum.info,e=>{i.getIcon("spinner-circle-dark",i.sizes.large).then(t=>{e.html('<div class="text-center">'+t+"</div>")}),this.getSummary(parseInt(n.data("pageId"),10),parseInt(n.data("languageId"),10)).then(async t=>{const l=await t.resolve();e.empty(),this.records=[];const s=l.columns.columns;l.columns.columnList.forEach(t=>{if(void 0===l.records[t])return;const i=s[t],o=a.default("<div />",{class:"row"});l.records[t].forEach(e=>{const t=" ("+e.uid+") "+e.title;this.records.push(e.uid),o.append(a.default("<div />",{class:"col-sm-6"}).append(a.default("<div />",{class:"input-group"}).append(a.default("<span />",{class:"input-group-addon"}).append(a.default("<input />",{type:"checkbox",class:"t3js-localization-toggle-record",id:"record-uid-"+e.uid,checked:"checked","data-uid":e.uid,"aria-label":t})),a.default("<label />",{class:"form-control",for:"record-uid-"+e.uid}).text(t).prepend(e.icon))))}),e.append(a.default("<fieldset />",{class:"localization-fieldset"}).append(a.default("<label />").text(i).prepend(a.default("<input />",{class:"t3js-localization-toggle-column",type:"checkbox",checked:"checked"})),o))}),o.unlockNextStep(),o.getComponent().on("change",".t3js-localization-toggle-record",e=>{const t=a.default(e.currentTarget),l=t.data("uid"),s=t.closest("fieldset"),i=s.find(".t3js-localization-toggle-column");if(t.is(":checked"))this.records.push(l);else{const e=this.records.indexOf(l);e>-1&&this.records.splice(e,1)}const n=s.find(".t3js-localization-toggle-record"),d=s.find(".t3js-localization-toggle-record:checked");i.prop("checked",d.length>0),i.prop("indeterminate",d.length>0&&d.length<n.length),this.records.length>0?o.unlockNextStep():o.lockNextStep()}).on("change",".t3js-localization-toggle-column",e=>{const t=a.default(e.currentTarget),l=t.closest("fieldset").find(".t3js-localization-toggle-record");l.prop("checked",t.is(":checked")),l.trigger("change")})})}),o.addFinalProcessingSlide(()=>{this.localizeRecords(parseInt(n.data("pageId"),10),parseInt(n.data("languageId"),10),this.records).then(()=>{o.dismiss(),document.location.reload()})}).then(()=>{o.show(),o.getComponent().on("click",".t3js-localization-option",e=>{const t=a.default(e.currentTarget),l=t.find('input[type="radio"]');if(t.data("helptext")){const l=a.default(e.delegateTarget);l.find(".t3js-localization-option").removeClass("active"),l.find(".t3js-helptext").addClass("text-muted"),t.addClass("active"),l.find(t.data("helptext")).removeClass("text-muted")}this.localizationMode=l.val(),o.unlockNextStep()})})})})})}loadAvailableLanguages(e,t){return new s(TYPO3.settings.ajaxUrls.page_languages).withQueryArguments({pageId:e,languageId:t}).get()}getSummary(e,t){return new s(TYPO3.settings.ajaxUrls.records_localize_summary).withQueryArguments({pageId:e,destLanguageId:t,languageId:this.sourceLanguage}).get()}localizeRecords(e,t,a){return new s(TYPO3.settings.ajaxUrls.records_localize).withQueryArguments({pageId:e,srcLanguageId:this.sourceLanguage,destLanguageId:t,action:this.localizationMode,uidList:a}).get()}}}));
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment