Automatic Translate Addon For Loco Translate - Version 2.1.1

Version Description

Download this release

Release Info

Developer Narinder singh
Plugin Icon 128x128 Automatic Translate Addon For Loco Translate
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1 to 2.1.1

assets/css/custom.css CHANGED
@@ -315,6 +315,6 @@ html.merge-translations:before {
315
  padding-top: 50px;
316
  }
317
 
318
- .ui-dialog.loco-modal.ui-draggable.addtranslations {
319
  border: 6px solid #5cb85c;
320
  }
315
  padding-top: 50px;
316
  }
317
 
318
+ .ui-dialog.loco-modal.addtranslations {
319
  border: 6px solid #5cb85c;
320
  }
assets/css/custom.min.css CHANGED
@@ -1 +1 @@
1
- #cool-auto-translate-btn:before{padding-right:5px!important}#cool-auto-translate-btn:after{content:"No API Required!";clear:both;display:block;font-size:10px;font-weight:700;font-family:monospace;position:absolute;bottom:-6px;left:-1px;background:#129412;width:calc(100% + 2px);height:12px;line-height:12px;color:#fff;text-align:center;border-radius:0 0 4px 4px}span.proonly-button{background:#555;color:#fff;font-size:12px;font-weight:700;font-family:monospace;padding:3px;border-radius:3px;display:inline-block;margin:2px 10px}span.proonly-button a{color:#fff;text-decoration:none}span.proonly-button.alsofree{background:green}span.proonly-button.alsofree img{filter:brightness(10);-webkit-filter:brightness(10)}#atlt_strings_model{display:none;position:fixed;z-index:99999;top:0;width:100%;height:100vh;overflow:hidden;background-color:rgba(0,0,0,.75)}#atlt_strings_model .modal-content{position:relative;background-color:#fefefe;width:80%;height:calc(100% - 40px);margin:32px auto 0;overflow:hidden;border-radius:5px;box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);-webkit-animation-name:animatetop;-webkit-animation-duration:.4s;animation-name:animatetop;animation-duration:.4s}@-webkit-keyframes animatetop{from{top:-300px;opacity:0}to{top:0;opacity:1}}@keyframes animatetop{from{top:-300px;opacity:0}to{top:0;opacity:1}}#atlt_strings_model .modal-header{padding:2px 16px;background-color:#5cb85c;color:#fff;height:86px;max-height:86px;overflow:hidden;position:relative}#atlt_strings_model .modal-header h2{display:inline-block;font-size:18px;color:#000;padding:0;margin:18px 159px 5px 0;width:calc(100% - 160px)}#atlt_strings_model .modal-header .close{color:#fff;font-size:28px;font-weight:700;position:absolute;right:10px;top:20px}#atlt_strings_model .modal-header .close:focus,#atlt_strings_model .modal-header .close:hover{color:#000;text-decoration:none;cursor:pointer}#atlt_strings_model .save_btn_cont{margin:8px;position:absolute;top:10px;right:40px}#atlt_strings_model .save_btn_cont button:not([disabled]):before{font-family:dashicons;content:"\f345";display:inline-block;font-size:24px;line-height:26px;vertical-align:middle;left:-20px;position:absolute;color:#fff;animation:moveit 5s infinite;-webkit-animation:moveit 1s infinite}@keyframes moveit{from{left:-22px}to{left:-10px}}#atlt_strings_model .ytstats{padding:0;margin:5px 160px 5px 0;width:calc(100% - 160px)}#atlt_strings_model .ytstats a{color:#fff936}#atlt_strings_model .modal-body{padding:2px 16px;position:relative}#atlt_strings_model .notice-dismiss{padding:0}#atlt_strings_model h3{width:100%;display:inline-block;font-size:22px;padding:0;margin:20px 0 10px;color:#5cb85c}#translate_element{margin-bottom:25px}#atlt_strings_model .string_container{overflow-y:scroll;overflow-x:hidden;height:calc(100vh - 460px);width:100%;position:relative}#atlt_strings_model table{border-spacing:0;border-collapse:collapse;width:100%;max-width:100%;table-layout:fixed;padding:0;margin:0}#atlt_strings_model table td:first-child,#atlt_strings_model table th:first-child{width:60px;text-align:center}#atlt_strings_model table td,#atlt_strings_model table th{border:1px solid #ddd;padding:4px;height:26px;text-align:left;white-space:nowrap;font-size:12px;line-height:14px;overflow:hidden;vertical-align:middle}#atlt_strings_model .my_translate_progress{position:absolute;display:none;top:0;left:10px;color:#fff;background:rgba(0,0,0,.5);width:calc(100% - 22px);border-radius:3px;height:100%;z-index:9;box-sizing:border-box;font-size:16px;line-height:20px;font-weight:700;text-align:center;padding-top:30px}#atlt_strings_model .modal-footer{padding:2px 16px;background-color:#5cb85c;color:#fff;position:absolute;width:calc(100% - 32px);bottom:0;height:66px;max-height:66px}.goog-te-banner-frame.skiptranslate{display:none!important}.goog-te-combo option:first-child{display:none}#yt-widget .yt-listbox__text{line-height:14px!important}#yt-widget .yt-listbox__input:not(:checked)~.yt-listbox__text{display:none!important}#loco-hint .loco-api.loco-api-loco_auto{display:none}html.merge-translations:before{position:fixed;width:100%;height:100%;background:rgb(0,0,0,.9);z-index:9999990;content:"Merging Translations.....";color:#fff;font-size:28px;text-align:center;padding-top:50px}.ui-dialog.loco-modal.ui-draggable.addtranslations{border:6px solid #5cb85c}
1
+ #cool-auto-translate-btn:before{padding-right:5px!important}#cool-auto-translate-btn:after{content:"No API Required!";clear:both;display:block;font-size:10px;font-weight:700;font-family:monospace;position:absolute;bottom:-6px;left:-1px;background:#129412;width:calc(100% + 2px);height:12px;line-height:12px;color:#fff;text-align:center;border-radius:0 0 4px 4px}span.proonly-button{background:#555;color:#fff;font-size:12px;font-weight:700;font-family:monospace;padding:3px;border-radius:3px;display:inline-block;margin:2px 10px}span.proonly-button a{color:#fff;text-decoration:none}span.proonly-button.alsofree{background:green}span.proonly-button.alsofree img{filter:brightness(10);-webkit-filter:brightness(10)}#atlt_strings_model{display:none;position:fixed;z-index:99999;top:0;width:100%;height:100vh;overflow:hidden;background-color:rgba(0,0,0,.75)}#atlt_strings_model .modal-content{position:relative;background-color:#fefefe;width:80%;height:calc(100% - 40px);margin:32px auto 0;overflow:hidden;border-radius:5px;box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);-webkit-animation-name:animatetop;-webkit-animation-duration:.4s;animation-name:animatetop;animation-duration:.4s}@-webkit-keyframes animatetop{from{top:-300px;opacity:0}to{top:0;opacity:1}}@keyframes animatetop{from{top:-300px;opacity:0}to{top:0;opacity:1}}#atlt_strings_model .modal-header{padding:2px 16px;background-color:#5cb85c;color:#fff;height:86px;max-height:86px;overflow:hidden;position:relative}#atlt_strings_model .modal-header h2{display:inline-block;font-size:18px;color:#000;padding:0;margin:18px 159px 5px 0;width:calc(100% - 160px)}#atlt_strings_model .modal-header .close{color:#fff;font-size:28px;font-weight:700;position:absolute;right:10px;top:20px}#atlt_strings_model .modal-header .close:focus,#atlt_strings_model .modal-header .close:hover{color:#000;text-decoration:none;cursor:pointer}#atlt_strings_model .save_btn_cont{margin:8px;position:absolute;top:10px;right:40px}#atlt_strings_model .save_btn_cont button:not([disabled]):before{font-family:dashicons;content:"\f345";display:inline-block;font-size:24px;line-height:26px;vertical-align:middle;left:-20px;position:absolute;color:#fff;animation:moveit 5s infinite;-webkit-animation:moveit 1s infinite}@keyframes moveit{from{left:-22px}to{left:-10px}}#atlt_strings_model .ytstats{padding:0;margin:5px 160px 5px 0;width:calc(100% - 160px)}#atlt_strings_model .ytstats a{color:#fff936}#atlt_strings_model .modal-body{padding:2px 16px;position:relative}#atlt_strings_model .notice-dismiss{padding:0}#atlt_strings_model h3{width:100%;display:inline-block;font-size:22px;padding:0;margin:20px 0 10px;color:#5cb85c}#translate_element{margin-bottom:25px}#atlt_strings_model .string_container{overflow-y:scroll;overflow-x:hidden;height:calc(100vh - 460px);width:100%;position:relative}#atlt_strings_model table{border-spacing:0;border-collapse:collapse;width:100%;max-width:100%;table-layout:fixed;padding:0;margin:0}#atlt_strings_model table td:first-child,#atlt_strings_model table th:first-child{width:60px;text-align:center}#atlt_strings_model table td,#atlt_strings_model table th{border:1px solid #ddd;padding:4px;height:26px;text-align:left;white-space:nowrap;font-size:12px;line-height:14px;overflow:hidden;vertical-align:middle}#atlt_strings_model .my_translate_progress{position:absolute;display:none;top:0;left:10px;color:#fff;background:rgba(0,0,0,.5);width:calc(100% - 22px);border-radius:3px;height:100%;z-index:9;box-sizing:border-box;font-size:16px;line-height:20px;font-weight:700;text-align:center;padding-top:30px}#atlt_strings_model .modal-footer{padding:2px 16px;background-color:#5cb85c;color:#fff;position:absolute;width:calc(100% - 32px);bottom:0;height:66px;max-height:66px}.goog-te-banner-frame.skiptranslate{display:none!important}.goog-te-combo option:first-child{display:none}#yt-widget .yt-listbox__text{line-height:14px!important}#yt-widget .yt-listbox__input:not(:checked)~.yt-listbox__text{display:none!important}#loco-hint .loco-api.loco-api-loco_auto{display:none}html.merge-translations:before{position:fixed;width:100%;height:100%;background:rgb(0,0,0,.9);z-index:9999990;content:"Merging Translations.....";color:#fff;font-size:28px;text-align:center;padding-top:50px}.ui-dialog.loco-modal.addtranslations{border:6px solid #5cb85c}
assets/js/custom.js CHANGED
@@ -30,10 +30,10 @@
30
 
31
  // integrates auto traslator button in editor
32
  function newaddAutoTranslationBtn() {
33
- if ($("#loco-toolbar").find("#cool-auto-translate-btn").length > 0) {
34
- $("#loco-toolbar").find("#cool-auto-translate-btn").remove();
35
  }
36
- const locoActions = $("#loco-toolbar").find("#loco-actions");
37
  const proActiveBtn = '<fieldset><button id="cool-auto-translate-btn" class="button has-icon icon-translate">Auto Translate</button></fieldset>';
38
  locoActions.append(proActiveBtn);
39
  }
@@ -200,7 +200,7 @@
200
  Loco Automatic Translate Addon</a>
201
  </strong>
202
  </div>
203
-
204
  </div>
205
  <div class="notice inline notice-info is-dismissible">Plugin will not translate any strings with HTML or special characters because Yandex Translator currently
206
  does not support HTML and special characters translations.
@@ -340,7 +340,7 @@
340
  };
341
  jQuery.post(ajaxUrl, data, function(response) {
342
 
343
- $('#loco-toolbar').find('button').each(function(i, el) {
344
  var id = el.getAttribute('data-loco');
345
  if (id == "auto") {
346
  $(el).trigger("click");
@@ -391,25 +391,26 @@
391
 
392
  $("html").addClass("merge-translations");
393
  var checkModal = setInterval(function() {
394
- if ($('.loco-modal').length && String($(".loco-modal").attr("style")).indexOf("block") > -1) {
395
  $("html").removeClass("merge-translations");
396
  $("select#auto-api").hide();
397
- $("#loco-auto a.icon-help").hide();
398
- $("#loco-auto #loco-job-progress").hide();
 
399
  $("select#auto-api option[value='loco_auto']").prop("selected", "selected");
400
  //$("select#auto-api option[value='loco_auto']").attr("selected", "selected");
401
  $("select#auto-api").val($("select#auto-api option[value='loco_auto']").val());
402
  $(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Step 3 - Add Translations into Editor and Save");
403
- $("#loco-auto button.button-primary span").html("Start Adding Process");
404
 
405
- $("#loco-auto button.button-primary").on("click",function(){
406
  $(this).find('span').html("Adding...");
407
  });
408
 
409
  $(".loco-modal").addClass("addtranslations");
410
  $('.noapiadded').remove();
411
- $(".loco-modal #loco-auto form").show();
412
- $(".loco-modal #loco-auto").removeClass("loco-alert");
413
  clearInterval(checkModal);
414
  }
415
  }, 100); // check every 100ms
@@ -418,29 +419,30 @@
418
  //Click on Loco Default Auto Button
419
  $("button.icon-robot[data-loco='auto']").on("click", function(e) {
420
  if (e.originalEvent !== undefined) {
421
- $(".loco-modal").removeClass("addtranslations");
422
- $("select#auto-api").show();
423
- $("#loco-auto a.icon-help").show();
424
- $("#loco-auto #loco-job-progress").show();
425
- $(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Auto-translate this file");
426
- $("#loco-auto button.button-primary span").html("Translate");
427
- var opt = 0;
428
- setTimeout(function() {
429
- $('select#auto-api option').each(function() {
430
- opt = opt + 1;
431
- });
432
- if (opt == 1) {
433
- $('.noapiadded').remove();
434
- $(".loco-modal #loco-auto").removeClass("loco-alert");
435
- $(".loco-modal #loco-auto form").hide();
436
- $(".loco-modal #loco-auto").addClass("loco-alert");
437
- $(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("No translation APIs configured");
438
- $(".loco-modal #loco-auto").append("<div class='noapiadded'><p>Add automatic translation services in the plugin settings.<br>or<br>Use <strong>Auto Translate</strong> addon button.</p><nav><a href='http://locotranslate.local/wp-admin/admin.php?page=loco-config&amp;action=apis' class='has-icon icon-cog'>Settings</a><a href='https://localise.biz/wordpress/plugin/manual/providers?utm_medium=plugin&amp;utm_campaign=wp&amp;utm_source=admin&amp;utm_content=plugin-file-edit' class='has-icon icon-help' target='_blank'>Help</a></nav></div>");
439
- } else {
440
- //$("select#auto-api option:nth-child(2)").prop("selected", "selected");
441
- //$("select#auto-api").val($("select#auto-api option:nth-child(2)").val());
442
- }
443
- }, 400);
 
444
  }
445
  });
446
 
30
 
31
  // integrates auto traslator button in editor
32
  function newaddAutoTranslationBtn() {
33
+ if ($("#loco-editor nav").find("#cool-auto-translate-btn").length > 0) {
34
+ $("#loco-editor nav").find("#cool-auto-translate-btn").remove();
35
  }
36
+ const locoActions = $("#loco-editor nav").find("#loco-actions");
37
  const proActiveBtn = '<fieldset><button id="cool-auto-translate-btn" class="button has-icon icon-translate">Auto Translate</button></fieldset>';
38
  locoActions.append(proActiveBtn);
39
  }
200
  Loco Automatic Translate Addon</a>
201
  </strong>
202
  </div>
203
+
204
  </div>
205
  <div class="notice inline notice-info is-dismissible">Plugin will not translate any strings with HTML or special characters because Yandex Translator currently
206
  does not support HTML and special characters translations.
340
  };
341
  jQuery.post(ajaxUrl, data, function(response) {
342
 
343
+ $('#loco-editor nav').find('button').each(function(i, el) {
344
  var id = el.getAttribute('data-loco');
345
  if (id == "auto") {
346
  $(el).trigger("click");
391
 
392
  $("html").addClass("merge-translations");
393
  var checkModal = setInterval(function() {
394
+ if ($('.loco-modal #loco-apis-batch').length && String($(".loco-modal").attr("style")).indexOf("block") > -1) {
395
  $("html").removeClass("merge-translations");
396
  $("select#auto-api").hide();
397
+ $("#loco-apis-batch a.icon-help").hide();
398
+ $("#loco-apis-batch a.icon-group").hide();
399
+ $("#loco-apis-batch #loco-job-progress").hide();
400
  $("select#auto-api option[value='loco_auto']").prop("selected", "selected");
401
  //$("select#auto-api option[value='loco_auto']").attr("selected", "selected");
402
  $("select#auto-api").val($("select#auto-api option[value='loco_auto']").val());
403
  $(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Step 3 - Add Translations into Editor and Save");
404
+ $("#loco-apis-batch button.button-primary span").html("Start Adding Process");
405
 
406
+ $("#loco-apis-batch button.button-primary").on("click",function(){
407
  $(this).find('span').html("Adding...");
408
  });
409
 
410
  $(".loco-modal").addClass("addtranslations");
411
  $('.noapiadded').remove();
412
+ $(".loco-modal #loco-apis-batch form").show();
413
+ $(".loco-modal #loco-apis-batch").removeClass("loco-alert");
414
  clearInterval(checkModal);
415
  }
416
  }, 100); // check every 100ms
419
  //Click on Loco Default Auto Button
420
  $("button.icon-robot[data-loco='auto']").on("click", function(e) {
421
  if (e.originalEvent !== undefined) {
422
+ var checkModal = setInterval(function() {
423
+ if ($('.loco-modal #loco-apis-batch').length && String($(".loco-modal").attr("style")).indexOf("block") > -1) {
424
+ $(".loco-modal").removeClass("addtranslations");
425
+ $("select#auto-api").show();
426
+ $("#loco-apis-batch a.icon-help").show(); //Show help button again.
427
+ $("#loco-apis-batch a.icon-group").show(); //Show human button again.
428
+ $("#loco-apis-batch #loco-job-progress").show(); //Show translation status again.
429
+ $(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Auto-translate this file");
430
+ $("#loco-apis-batch button.button-primary span").html("Translate");
431
+ var opt = 0;
432
+ $('select#auto-api option').each(function() {
433
+ opt = opt + 1;
434
+ });
435
+ if (opt == 1) {
436
+ $('.noapiadded').remove();
437
+ $(".loco-modal #loco-apis-batch").removeClass("loco-alert");
438
+ $(".loco-modal #loco-apis-batch form").hide();
439
+ $(".loco-modal #loco-apis-batch").addClass("loco-alert");
440
+ $(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("No translation APIs configured");
441
+ $(".loco-modal #loco-apis-batch").append("<div class='noapiadded'><p>Add automatic translation services in the plugin settings.<br>or<br>Use <strong>Auto Translate</strong> addon button.</p><nav><a href='http://locotranslate.local/wp-admin/admin.php?page=loco-config&amp;action=apis' class='button button-link has-icon icon-cog'>Settings</a><a href='https://localise.biz/wordpress/plugin/manual/providers' class='button button-link has-icon icon-help' target='_blank'>Help</a><a href='https://localise.biz/wordpress/translation?l=de-DE' class='button button-link has-icon icon-group' target='_blank'>Need a human?</a></nav></div>");
442
+ }
443
+ clearInterval(checkModal);
444
+ }
445
+ }, 100); // check every 100ms
446
  }
447
  });
448
 
assets/js/custom.min.js CHANGED
@@ -1 +1 @@
1
- !function(window,$){if(null!=window.locoConf){var locoConf=window.locoConf;if(null!=locoConf.conf){var allStrings=locoConf.conf.podata;allStrings.shift();var ajaxUrl=extradata.ajax_url,nonces=extradata.nonce,locale=locoConf.conf.locale,projectId="";projectId=null!=locoConf.conf.project?locoConf.conf.project.domain+"-"+locale.lang+"_"+locale.region:"temp-"+locale.lang+"_"+locale.region,newaddAutoTranslationBtn(),settingsModel(),createStringsPopup()}}function newaddAutoTranslationBtn(){$("#loco-toolbar").find("#cool-auto-translate-btn").length>0&&$("#loco-toolbar").find("#cool-auto-translate-btn").remove();const locoActions=$("#loco-toolbar").find("#loco-actions"),proActiveBtn='<fieldset><button id="cool-auto-translate-btn" class="button has-icon icon-translate">Auto Translate</button></fieldset>';locoActions.append(proActiveBtn)}function createPopup(){$("#atlt-dialog").dialog({resizable:!1,height:"auto",width:400,modal:!0,buttons:{Cancel:function(){$(this).dialog("close")}}})}$("#cool-auto-translate-btn").on("click",(function(){createPopup()}));var encodeHtmlEntity=function(str){for(var buf=[],i=str.length-1;i>=0;i--)buf.unshift(["&#",str[i].charCodeAt(),";"].join(""));return buf.join("")};function printStringsInPopup(jsonObj,type){var html="",totalTChars=0,index=1;if(jsonObj){for(const key in jsonObj)if(jsonObj.hasOwnProperty(key)){const element=jsonObj[key];if(""!=element.source){if("yandex"==type)html+='<tr id="'+key+'" ><td>'+index+'</td><td class="notranslate source" >'+encodeHtmlEntity(element.source)+"</td>";else{if(key>2500)break;html+='<tr id="'+key+'" ><td>'+index+'</td><td class="notranslate source">'+element.source+"</td>"}html+="yandex"==type?'<td translate="yes" class="target translate">'+element.source+"</td></tr>":'<td class="target translate"></td></tr>',index++,totalTChars+=element.source.length}}$(".ytstats").each((function(){$(this).find(".totalChars").html(totalTChars)}))}"yandex"==type&&$("#yandex_string_tbl").html(html)}var gModal=document.getElementById("atlt_strings_model");function settingsModel(){let ytPreviewImg,gtPreviewImg,dplPreviewImg,modelHTML=` \n \x3c!-- The Modal --\x3e\n <div id="atlt-dialog" title="Step 1 - Select Translation Provider" style="display:none;">\n <div class="atlt-settings">\n \n <strong class="atlt-heading" style="margin-bottom:10px;display:inline-block;">Translate Using Yandex Page Translate Widget</strong>\n <div class="inputGroup">\n <button id="atlt_yandex_transate_btn" class="notranslate button button-primary">Yandex Translate</button>\n <span class="proonly-button alsofree">✔ Available</span>\n <br/><a href="https://translate.yandex.com/" target="_blank"><img style="margin-top: 5px;" src="${extradata.yt_preview}" alt="powered by Yandex Translate Widget"></a>\n </div>\n <hr/>\n \n <strong class="atlt-heading" style="margin-bottom:10px;display:inline-block;">Translate Using Google Page Translate Widget</strong>\n <div class="inputGroup">\n <button id="atlt_gtranslate_btn" disabled="disabled" class="notranslate button button-primary">Google Translate</button>\n <span class="proonly-button"><a href="https://bit.ly/locoaddon" target="_blank" title="Buy Pro">PRO Only</a></span>\n <br/><a href="https://translate.google.com/" target="_blank"><img style="margin-top: 5px;" src="${extradata.gt_preview}" alt="powered by Google Translate Widget"></a>\n </div>\n <hr/>\n \n <strong class="atlt-heading" style="margin-bottom:10px;display:inline-block;">Translate Using Deepl Doc Translator</strong>\n <div class="inputGroup">\n <button disabled="disabled" id="atlt_deepl_btn" class="notranslate button button-primary">DeepL Translate</button>\n <span class="proonly-button"><a href="https://bit.ly/locoaddon" target="_blank" title="Buy Pro">PRO Only</a></span>\n <br/><a href="https://www.deepl.com/en/translator" target="_blank"><img style="margin-top: 5px;" src="${extradata.dpl_preview}" alt="powered by DeepL Translate"></a>\n <br/>DeepL translation is better than Google, Microsoft & other auto-translation providers - <a href="https://techcrunch.com/2017/08/29/deepl-schools-other-online-translators-with-clever-machine-learning/" target="_blank">read review by techcruch</a>\n </div>\n <hr/>\n \n <ul style="margin: 0;">\n <li><span style="color:green">✔</span> Unlimited Translations<br/>(<span style="font-size: 11px;color: #248e09;">*DeepL provides limited no. of free doc translations daily</span>)</li>\n <li><span style="color:green">✔</span> No API Key Required</li>\n <li><span style="color:green">✔</span> Check Languages Support - <a href="https://yandex.com/support/translate/supported-langs.html" target="_blank">Yandex</a>, <a href="https://en.wikipedia.org/wiki/Google_Translate#Supported_languages" target="_blank">Google</a>, <a href="https://www.deepl.com/en/translator" target="_blank">DeepL</a></li>\n </ul>\n \n </div>\n </div>\n `;$("body").append(modelHTML)}function createStringsPopup(){let modelHTML=` \n \x3c!-- The Modal --\x3e\n <div id="atlt_strings_model" class="modal atlt_custom_model">\n \x3c!-- Modal content --\x3e\n <div class="modal-content">\n <input type="hidden" id="project_id" value="${projectId}">\n <div class="modal-header">\n <span class="close ">&times;</span>\n <h2 class="notranslate">Step 2 - Start Automatic Translation Process</h2>\n <div class="save_btn_cont">\n <button class="notranslate save_it button button-primary" disabled="true">Merge Translation</button>\n </div>\n \n <div style="display:none" class="ytstats hidden">\n Wahooo! You have saved your valauble time via auto translating \n <strong class="totalChars"> </strong> characters using \n <strong> \n <a href="https://wordpress.org/support/plugin/automatic-translator-addon-for-loco-translate/reviews/#new-post" target="_new">\n Loco Automatic Translate Addon</a>\n </strong> \n </div>\n \n </div>\n <div class="notice inline notice-info is-dismissible">Plugin will not translate any strings with HTML or special characters because Yandex Translator currently\n does not support HTML and special characters translations. \n You can edit translated strings inside Loco Translate Editor after merging the translations. Only special chracters (%s, %d) fixed at the time of merging of the translations.</div>\n <div class="notice inline notice-info is-dismissible">Machine translations are not 100% correct.\n Please verify strings before using on production website.</div>\n <div class="modal-body">\n <div class="my_translate_progress">Automatic translation is in progress....<br/>It will take few minutes, enjoy ☕ coffee in this time!<br/><br/>Please do not leave this window or browser tab while translation is in progress...</div>\n <h3 class="choose-lang">Choose language <span class="dashicons-before dashicons-translation"></span></h3>\n <div id="ytWidget">..Loading</div>\n <br/>\n <div class="string_container"> \n <table class="scrolldown" id="stringTemplate">\n <thead>\n <th class="notranslate">S.No</th>\n <th class="notranslate">Source Text</th>\n <th class="notranslate">Translation</th>\n </thead>\n <tbody id="yandex_string_tbl">\n </tbody>\n </table>\n </div>\n <div class="notice-container"></div>\n </div>\n <div class="modal-footer">\n <div class="save_btn_cont">\n <button class="notranslate save_it button button-primary" disabled="true">Merge Translation</button>\n </div>\n <div style="display:none" class="ytstats">\n Wahooo! You have saved your valauble time via auto translating \n <strong class="totalChars"></strong> characters using \n <strong> \n <a href="https://wordpress.org/support/plugin/automatic-translator-addon-for-loco-translate/reviews/#new-post" target="_new">\n Loco Automatic Translate Addon</a>\n </strong> \n </div>\n </div>\n </div>\n </div>`;$("body").append(modelHTML)}function saveTranslatedStrings(translatedObj,projectId){if(void 0!==translatedObj&&translatedObj.length)if(translatedObj.length<5e3&&translatedObj.length>=2500){var firstPart=translatedObj.slice(0,2500),secondPart=translatedObj.slice(2500);sendRequest(firstPart,projectId,part="first"),sendRequest(secondPart,projectId,part="second")}else if(translatedObj.length>=5e3){var firstPart=translatedObj.slice(0,2500),secondPart=translatedObj.slice(2500,5e3),thirdpart=translatedObj.slice(5e3);sendRequest(firstPart,projectId,part="first"),sendRequest(secondPart,projectId,part="second"),sendRequest(thirdpart,projectId,part="third")}else sendRequest(translatedObj,projectId,part="one")}function sendRequest(stringData,projectId,part){var data={action:"save_translations",data:JSON.stringify(stringData),part:part,"project-id":projectId};jQuery.post(ajaxUrl,data,(function(response){$("#loco-toolbar").find("button").each((function(i,el){var id;"auto"==el.getAttribute("data-loco")&&$(el).trigger("click")}))}))}window.onclick=function(event){event.target==gModal&&(gModal.style.display="none")},$("#atlt_strings_model").find(".close").on("click",(function(){$("#atlt_strings_model").fadeOut("slow")})),$("#atlt_yandex_transate_btn").on("click",(function(){var defaultcode=locale.lang?locale.lang:null,arr;switch(defaultcode){case"bel":defaultlang="be";break;case"he":defaultlang="iw";break;case"snd":defaultlang="sd";break;case"jv":defaultlang="jv";break;case"nb":case"nn":defaultlang="no";break;default:defaultlang=defaultcode}$(".save_it").prop("disabled",!0),$(".ytstats").css("display","none"),localStorage.setItem("lang",defaultlang),["af","jv","no","am","ar","az","ba","be","bg","bn","bs","ca","ceb","cs","cy","da","de","el","en","eo","es","et","eu","fa","fi","fr","ga","gd","gl","gu","he","hi","hr","ht","hu","hy","id","is","it","ja","jv","ka","kk","km","kn","ko","ky","la","lb","lo","lt","lv","mg","mhr","mi","mk","ml","mn","mr","mrj","ms","mt","my","ne","nl","no","pa","pap","pl","pt","ro","ru","si","sk","sl","sq","sr","su","sv","sw","ta","te","tg","th","tl","tr","tt","udm","uk","ur","uz","vi","xh","yi","zh"].includes(defaultlang)||($(".notice-container").addClass("notice inline notice-warning").html("Yandex Automatic Translator Does not support this language."),$(".string_container").hide(),$(".choose-lang").hide(),$(".save_it").hide(),$("#ytWidget").hide());var plainStrArr=filterRawObject(allStrings,"plain");plainStrArr.length>0?printStringsInPopup(plainStrArr,type="yandex"):($("#ytWidget").hide(),$(".notice-container").addClass("notice inline notice-warning").html("There is no plain string available for translations."),$(".string_container").hide(),$(".choose-lang").hide(),$(".save_it").hide()),$("#atlt-dialog").dialog("close"),$("#atlt_strings_model").addClass("yandex-translator").fadeIn("slow")}));var rpl={'"% s"':'"%s"','"% d"':'"%d"','"% S"':'"%s"','"% D"':'"%d"',"% s":" %s ","% S":" %s ","% d":" %d ","% D":" %d ","٪ s":" %s ","٪ S":" %s ","٪ d":" %d ","٪ D":" %d ","٪ س":" %s "};function filterRawObject(rawArray,filterType){return filterdArr=[],filterdArr=rawArray.filter((item,index)=>{if(""!==item.source&&void 0!==item.source&&(void 0===item.target||""==item.target))return!ValidURL(item.source)&&(!isHTML(item.source)&&(!!isPlacehodersChars(item.source)||!isSpecialChars(item.source)&&(!isEmoji(item.source)&&!item.source.includes("#"))))})}function ValidURL(str){var pattern;return!!/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(str)}function isHTML(str){var rgex;return void 0!==str&&/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(str)}function isSpecialChars(str){var rgex;return void 0!==str&&/[@^{}|<>]/g.test(str)}function isEmoji(str){var ranges=["(?:[✀-➿]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[#-9]️?⃣|㊙|㊗|〽|〰|Ⓜ|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|🆎|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|🈚|🈯|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|‼|⁉|[▪-▫]|▶|◀|[◻-◾]|©|®|™|ℹ|🀄|[☀-⛿]|⬅|⬆|⬇|⬛|⬜|⭐|⭕|⌚|⌛|⌨|⏏|[⏩-⏳]|[⏸-⏺]|🃏|⤴|⤵|[←-⇿])"];return!!str.match(ranges.join("|"))}function isPlacehodersChars(str){var rgex;return void 0!==str&&/%s|%d/g.test(str)}function strtr(s,p,r){return!!s&&{2:function(){for(var i in p)s=strtr(s,i,p[i]);return s},3:function(){return s.replace(RegExp(p,"g"),r)},0:function(){}}[arguments.length]()}$(".save_it").on("click",(function(){var translatedObj=[];$("#stringTemplate tbody tr").each((function(index){var index=$(this).find("td.source").text(),target=$(this).find("td.target").text(),source=$(this).find("td.source").text(),improvedTarget=strtr(target,rpl),improvedSource=strtr(source,rpl);translatedObj.push({source:improvedSource,target:improvedTarget})}));var projectId=$(this).parents("#atlt_strings_model").find("#project_id").val();saveTranslatedStrings(translatedObj,projectId);var translatedObj=[];$(".atlt_custom_model").fadeOut("slow"),$("html").addClass("merge-translations");var checkModal=setInterval((function(){$(".loco-modal").length&&String($(".loco-modal").attr("style")).indexOf("block")>-1&&($("html").removeClass("merge-translations"),$("select#auto-api").hide(),$("#loco-auto a.icon-help").hide(),$("#loco-auto #loco-job-progress").hide(),$("select#auto-api option[value='loco_auto']").prop("selected","selected"),$("select#auto-api").val($("select#auto-api option[value='loco_auto']").val()),$(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Step 3 - Add Translations into Editor and Save"),$("#loco-auto button.button-primary span").html("Start Adding Process"),$("#loco-auto button.button-primary").on("click",(function(){$(this).find("span").html("Adding...")})),$(".loco-modal").addClass("addtranslations"),$(".noapiadded").remove(),$(".loco-modal #loco-auto form").show(),$(".loco-modal #loco-auto").removeClass("loco-alert"),clearInterval(checkModal))}),100)})),$("button.icon-robot[data-loco='auto']").on("click",(function(e){if(void 0!==e.originalEvent){$(".loco-modal").removeClass("addtranslations"),$("select#auto-api").show(),$("#loco-auto a.icon-help").show(),$("#loco-auto #loco-job-progress").show(),$(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Auto-translate this file"),$("#loco-auto button.button-primary span").html("Translate");var opt=0;setTimeout((function(){$("select#auto-api option").each((function(){opt+=1})),1==opt&&($(".noapiadded").remove(),$(".loco-modal #loco-auto").removeClass("loco-alert"),$(".loco-modal #loco-auto form").hide(),$(".loco-modal #loco-auto").addClass("loco-alert"),$(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("No translation APIs configured"),$(".loco-modal #loco-auto").append("<div class='noapiadded'><p>Add automatic translation services in the plugin settings.<br>or<br>Use <strong>Auto Translate</strong> addon button.</p><nav><a href='http://locotranslate.local/wp-admin/admin.php?page=loco-config&amp;action=apis' class='has-icon icon-cog'>Settings</a><a href='https://localise.biz/wordpress/plugin/manual/providers?utm_medium=plugin&amp;utm_campaign=wp&amp;utm_source=admin&amp;utm_content=plugin-file-edit' class='has-icon icon-help' target='_blank'>Help</a></nav></div>"))}),400)}}))}(window,jQuery);
1
+ !function(window,$){if(null!=window.locoConf){var locoConf=window.locoConf;if(null!=locoConf.conf){var allStrings=locoConf.conf.podata;allStrings.shift();var ajaxUrl=extradata.ajax_url,nonces=extradata.nonce,locale=locoConf.conf.locale,projectId="";projectId=null!=locoConf.conf.project?locoConf.conf.project.domain+"-"+locale.lang+"_"+locale.region:"temp-"+locale.lang+"_"+locale.region,newaddAutoTranslationBtn(),settingsModel(),createStringsPopup()}}function newaddAutoTranslationBtn(){$("#loco-editor nav").find("#cool-auto-translate-btn").length>0&&$("#loco-editor nav").find("#cool-auto-translate-btn").remove();const locoActions=$("#loco-editor nav").find("#loco-actions"),proActiveBtn='<fieldset><button id="cool-auto-translate-btn" class="button has-icon icon-translate">Auto Translate</button></fieldset>';locoActions.append(proActiveBtn)}function createPopup(){$("#atlt-dialog").dialog({resizable:!1,height:"auto",width:400,modal:!0,buttons:{Cancel:function(){$(this).dialog("close")}}})}$("#cool-auto-translate-btn").on("click",(function(){createPopup()}));var encodeHtmlEntity=function(str){for(var buf=[],i=str.length-1;i>=0;i--)buf.unshift(["&#",str[i].charCodeAt(),";"].join(""));return buf.join("")};function printStringsInPopup(jsonObj,type){var html="",totalTChars=0,index=1;if(jsonObj){for(const key in jsonObj)if(jsonObj.hasOwnProperty(key)){const element=jsonObj[key];if(""!=element.source){if("yandex"==type)html+='<tr id="'+key+'" ><td>'+index+'</td><td class="notranslate source" >'+encodeHtmlEntity(element.source)+"</td>";else{if(key>2500)break;html+='<tr id="'+key+'" ><td>'+index+'</td><td class="notranslate source">'+element.source+"</td>"}html+="yandex"==type?'<td translate="yes" class="target translate">'+element.source+"</td></tr>":'<td class="target translate"></td></tr>',index++,totalTChars+=element.source.length}}$(".ytstats").each((function(){$(this).find(".totalChars").html(totalTChars)}))}"yandex"==type&&$("#yandex_string_tbl").html(html)}var gModal=document.getElementById("atlt_strings_model");function settingsModel(){let ytPreviewImg,gtPreviewImg,dplPreviewImg,modelHTML=` \n \x3c!-- The Modal --\x3e\n <div id="atlt-dialog" title="Step 1 - Select Translation Provider" style="display:none;">\n <div class="atlt-settings">\n \n <strong class="atlt-heading" style="margin-bottom:10px;display:inline-block;">Translate Using Yandex Page Translate Widget</strong>\n <div class="inputGroup">\n <button id="atlt_yandex_transate_btn" class="notranslate button button-primary">Yandex Translate</button>\n <span class="proonly-button alsofree">✔ Available</span>\n <br/><a href="https://translate.yandex.com/" target="_blank"><img style="margin-top: 5px;" src="${extradata.yt_preview}" alt="powered by Yandex Translate Widget"></a>\n </div>\n <hr/>\n \n <strong class="atlt-heading" style="margin-bottom:10px;display:inline-block;">Translate Using Google Page Translate Widget</strong>\n <div class="inputGroup">\n <button id="atlt_gtranslate_btn" disabled="disabled" class="notranslate button button-primary">Google Translate</button>\n <span class="proonly-button"><a href="https://bit.ly/locoaddon" target="_blank" title="Buy Pro">PRO Only</a></span>\n <br/><a href="https://translate.google.com/" target="_blank"><img style="margin-top: 5px;" src="${extradata.gt_preview}" alt="powered by Google Translate Widget"></a>\n </div>\n <hr/>\n \n <strong class="atlt-heading" style="margin-bottom:10px;display:inline-block;">Translate Using Deepl Doc Translator</strong>\n <div class="inputGroup">\n <button disabled="disabled" id="atlt_deepl_btn" class="notranslate button button-primary">DeepL Translate</button>\n <span class="proonly-button"><a href="https://bit.ly/locoaddon" target="_blank" title="Buy Pro">PRO Only</a></span>\n <br/><a href="https://www.deepl.com/en/translator" target="_blank"><img style="margin-top: 5px;" src="${extradata.dpl_preview}" alt="powered by DeepL Translate"></a>\n <br/>DeepL translation is better than Google, Microsoft & other auto-translation providers - <a href="https://techcrunch.com/2017/08/29/deepl-schools-other-online-translators-with-clever-machine-learning/" target="_blank">read review by techcruch</a>\n </div>\n <hr/>\n \n <ul style="margin: 0;">\n <li><span style="color:green">✔</span> Unlimited Translations<br/>(<span style="font-size: 11px;color: #248e09;">*DeepL provides limited no. of free doc translations daily</span>)</li>\n <li><span style="color:green">✔</span> No API Key Required</li>\n <li><span style="color:green">✔</span> Check Languages Support - <a href="https://yandex.com/support/translate/supported-langs.html" target="_blank">Yandex</a>, <a href="https://en.wikipedia.org/wiki/Google_Translate#Supported_languages" target="_blank">Google</a>, <a href="https://www.deepl.com/en/translator" target="_blank">DeepL</a></li>\n </ul>\n \n </div>\n </div>\n `;$("body").append(modelHTML)}function createStringsPopup(){let modelHTML=` \n \x3c!-- The Modal --\x3e\n <div id="atlt_strings_model" class="modal atlt_custom_model">\n \x3c!-- Modal content --\x3e\n <div class="modal-content">\n <input type="hidden" id="project_id" value="${projectId}">\n <div class="modal-header">\n <span class="close ">&times;</span>\n <h2 class="notranslate">Step 2 - Start Automatic Translation Process</h2>\n <div class="save_btn_cont">\n <button class="notranslate save_it button button-primary" disabled="true">Merge Translation</button>\n </div>\n \n <div style="display:none" class="ytstats hidden">\n Wahooo! You have saved your valauble time via auto translating \n <strong class="totalChars"> </strong> characters using \n <strong> \n <a href="https://wordpress.org/support/plugin/automatic-translator-addon-for-loco-translate/reviews/#new-post" target="_new">\n Loco Automatic Translate Addon</a>\n </strong> \n </div>\n \n </div>\n <div class="notice inline notice-info is-dismissible">Plugin will not translate any strings with HTML or special characters because Yandex Translator currently\n does not support HTML and special characters translations. \n You can edit translated strings inside Loco Translate Editor after merging the translations. Only special chracters (%s, %d) fixed at the time of merging of the translations.</div>\n <div class="notice inline notice-info is-dismissible">Machine translations are not 100% correct.\n Please verify strings before using on production website.</div>\n <div class="modal-body">\n <div class="my_translate_progress">Automatic translation is in progress....<br/>It will take few minutes, enjoy ☕ coffee in this time!<br/><br/>Please do not leave this window or browser tab while translation is in progress...</div>\n <h3 class="choose-lang">Choose language <span class="dashicons-before dashicons-translation"></span></h3>\n <div id="ytWidget">..Loading</div>\n <br/>\n <div class="string_container"> \n <table class="scrolldown" id="stringTemplate">\n <thead>\n <th class="notranslate">S.No</th>\n <th class="notranslate">Source Text</th>\n <th class="notranslate">Translation</th>\n </thead>\n <tbody id="yandex_string_tbl">\n </tbody>\n </table>\n </div>\n <div class="notice-container"></div>\n </div>\n <div class="modal-footer">\n <div class="save_btn_cont">\n <button class="notranslate save_it button button-primary" disabled="true">Merge Translation</button>\n </div>\n <div style="display:none" class="ytstats">\n Wahooo! You have saved your valauble time via auto translating \n <strong class="totalChars"></strong> characters using \n <strong> \n <a href="https://wordpress.org/support/plugin/automatic-translator-addon-for-loco-translate/reviews/#new-post" target="_new">\n Loco Automatic Translate Addon</a>\n </strong> \n </div>\n </div>\n </div>\n </div>`;$("body").append(modelHTML)}function saveTranslatedStrings(translatedObj,projectId){if(void 0!==translatedObj&&translatedObj.length)if(translatedObj.length<5e3&&translatedObj.length>=2500){var firstPart=translatedObj.slice(0,2500),secondPart=translatedObj.slice(2500);sendRequest(firstPart,projectId,part="first"),sendRequest(secondPart,projectId,part="second")}else if(translatedObj.length>=5e3){var firstPart=translatedObj.slice(0,2500),secondPart=translatedObj.slice(2500,5e3),thirdpart=translatedObj.slice(5e3);sendRequest(firstPart,projectId,part="first"),sendRequest(secondPart,projectId,part="second"),sendRequest(thirdpart,projectId,part="third")}else sendRequest(translatedObj,projectId,part="one")}function sendRequest(stringData,projectId,part){var data={action:"save_translations",data:JSON.stringify(stringData),part:part,"project-id":projectId};jQuery.post(ajaxUrl,data,(function(response){$("#loco-editor nav").find("button").each((function(i,el){var id;"auto"==el.getAttribute("data-loco")&&$(el).trigger("click")}))}))}window.onclick=function(event){event.target==gModal&&(gModal.style.display="none")},$("#atlt_strings_model").find(".close").on("click",(function(){$("#atlt_strings_model").fadeOut("slow")})),$("#atlt_yandex_transate_btn").on("click",(function(){var defaultcode=locale.lang?locale.lang:null,arr;switch(defaultcode){case"bel":defaultlang="be";break;case"he":defaultlang="iw";break;case"snd":defaultlang="sd";break;case"jv":defaultlang="jv";break;case"nb":case"nn":defaultlang="no";break;default:defaultlang=defaultcode}$(".save_it").prop("disabled",!0),$(".ytstats").css("display","none"),localStorage.setItem("lang",defaultlang),["af","jv","no","am","ar","az","ba","be","bg","bn","bs","ca","ceb","cs","cy","da","de","el","en","eo","es","et","eu","fa","fi","fr","ga","gd","gl","gu","he","hi","hr","ht","hu","hy","id","is","it","ja","jv","ka","kk","km","kn","ko","ky","la","lb","lo","lt","lv","mg","mhr","mi","mk","ml","mn","mr","mrj","ms","mt","my","ne","nl","no","pa","pap","pl","pt","ro","ru","si","sk","sl","sq","sr","su","sv","sw","ta","te","tg","th","tl","tr","tt","udm","uk","ur","uz","vi","xh","yi","zh"].includes(defaultlang)||($(".notice-container").addClass("notice inline notice-warning").html("Yandex Automatic Translator Does not support this language."),$(".string_container").hide(),$(".choose-lang").hide(),$(".save_it").hide(),$("#ytWidget").hide());var plainStrArr=filterRawObject(allStrings,"plain");plainStrArr.length>0?printStringsInPopup(plainStrArr,type="yandex"):($("#ytWidget").hide(),$(".notice-container").addClass("notice inline notice-warning").html("There is no plain string available for translations."),$(".string_container").hide(),$(".choose-lang").hide(),$(".save_it").hide()),$("#atlt-dialog").dialog("close"),$("#atlt_strings_model").addClass("yandex-translator").fadeIn("slow")}));var rpl={'"% s"':'"%s"','"% d"':'"%d"','"% S"':'"%s"','"% D"':'"%d"',"% s":" %s ","% S":" %s ","% d":" %d ","% D":" %d ","٪ s":" %s ","٪ S":" %s ","٪ d":" %d ","٪ D":" %d ","٪ س":" %s "};function filterRawObject(rawArray,filterType){return filterdArr=[],filterdArr=rawArray.filter((item,index)=>{if(""!==item.source&&void 0!==item.source&&(void 0===item.target||""==item.target))return!ValidURL(item.source)&&(!isHTML(item.source)&&(!!isPlacehodersChars(item.source)||!isSpecialChars(item.source)&&(!isEmoji(item.source)&&!item.source.includes("#"))))})}function ValidURL(str){var pattern;return!!/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(str)}function isHTML(str){var rgex;return void 0!==str&&/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(str)}function isSpecialChars(str){var rgex;return void 0!==str&&/[@^{}|<>]/g.test(str)}function isEmoji(str){var ranges=["(?:[✀-➿]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[#-9]️?⃣|㊙|㊗|〽|〰|Ⓜ|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|🆎|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|🈚|🈯|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|‼|⁉|[▪-▫]|▶|◀|[◻-◾]|©|®|™|ℹ|🀄|[☀-⛿]|⬅|⬆|⬇|⬛|⬜|⭐|⭕|⌚|⌛|⌨|⏏|[⏩-⏳]|[⏸-⏺]|🃏|⤴|⤵|[←-⇿])"];return!!str.match(ranges.join("|"))}function isPlacehodersChars(str){var rgex;return void 0!==str&&/%s|%d/g.test(str)}function strtr(s,p,r){return!!s&&{2:function(){for(var i in p)s=strtr(s,i,p[i]);return s},3:function(){return s.replace(RegExp(p,"g"),r)},0:function(){}}[arguments.length]()}$(".save_it").on("click",(function(){var translatedObj=[];$("#stringTemplate tbody tr").each((function(index){var index=$(this).find("td.source").text(),target=$(this).find("td.target").text(),source=$(this).find("td.source").text(),improvedTarget=strtr(target,rpl),improvedSource=strtr(source,rpl);translatedObj.push({source:improvedSource,target:improvedTarget})}));var projectId=$(this).parents("#atlt_strings_model").find("#project_id").val();saveTranslatedStrings(translatedObj,projectId);var translatedObj=[];$(".atlt_custom_model").fadeOut("slow"),$("html").addClass("merge-translations");var checkModal=setInterval((function(){$(".loco-modal #loco-apis-batch").length&&String($(".loco-modal").attr("style")).indexOf("block")>-1&&($("html").removeClass("merge-translations"),$("select#auto-api").hide(),$("#loco-apis-batch a.icon-help").hide(),$("#loco-apis-batch a.icon-group").hide(),$("#loco-apis-batch #loco-job-progress").hide(),$("select#auto-api option[value='loco_auto']").prop("selected","selected"),$("select#auto-api").val($("select#auto-api option[value='loco_auto']").val()),$(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Step 3 - Add Translations into Editor and Save"),$("#loco-apis-batch button.button-primary span").html("Start Adding Process"),$("#loco-apis-batch button.button-primary").on("click",(function(){$(this).find("span").html("Adding...")})),$(".loco-modal").addClass("addtranslations"),$(".noapiadded").remove(),$(".loco-modal #loco-apis-batch form").show(),$(".loco-modal #loco-apis-batch").removeClass("loco-alert"),clearInterval(checkModal))}),100)})),$("button.icon-robot[data-loco='auto']").on("click",(function(e){if(void 0!==e.originalEvent)var checkModal=setInterval((function(){if($(".loco-modal #loco-apis-batch").length&&String($(".loco-modal").attr("style")).indexOf("block")>-1){$(".loco-modal").removeClass("addtranslations"),$("select#auto-api").show(),$("#loco-apis-batch a.icon-help").show(),$("#loco-apis-batch a.icon-group").show(),$("#loco-apis-batch #loco-job-progress").show(),$(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("Auto-translate this file"),$("#loco-apis-batch button.button-primary span").html("Translate");var opt=0;$("select#auto-api option").each((function(){opt+=1})),1==opt&&($(".noapiadded").remove(),$(".loco-modal #loco-apis-batch").removeClass("loco-alert"),$(".loco-modal #loco-apis-batch form").hide(),$(".loco-modal #loco-apis-batch").addClass("loco-alert"),$(".loco-modal .ui-dialog-titlebar .ui-dialog-title").html("No translation APIs configured"),$(".loco-modal #loco-apis-batch").append("<div class='noapiadded'><p>Add automatic translation services in the plugin settings.<br>or<br>Use <strong>Auto Translate</strong> addon button.</p><nav><a href='http://locotranslate.local/wp-admin/admin.php?page=loco-config&amp;action=apis' class='button button-link has-icon icon-cog'>Settings</a><a href='https://localise.biz/wordpress/plugin/manual/providers' class='button button-link has-icon icon-help' target='_blank'>Help</a><a href='https://localise.biz/wordpress/translation?l=de-DE' class='button button-link has-icon icon-group' target='_blank'>Need a human?</a></nav></div>")),clearInterval(checkModal)}}),100)}))}(window,jQuery);
automatic-translator-addon-for-loco-translate.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  Plugin Name:Automatic Translate Addon For Loco Translate
4
  Description:Auto language translator add-on for Loco Translate official plugin version 2.4.0 to translate plugins and themes translation files into any language via fully automatic machine translations via Yandex Translate Widget.
5
- Version:2.1
6
  License:GPL2
7
- Text Domain:loco-translate-addon
8
  Domain Path:languages
9
  Author:Cool Plugins
10
  Author URI:https://coolplugins.net/
@@ -14,7 +14,7 @@ use LocoAutoTranslateAddon\Helpers\Helpers;
14
  use LocoAutoTranslateAddon\Helpers\Atlt_downloader;
15
  /**
16
  * @package Loco Automatic Translate Addon
17
- * @version 2.1
18
  */
19
  if (!defined('ABSPATH')) {
20
  die('WordPress Environment Not Found!');
@@ -23,7 +23,7 @@ if (!defined('ABSPATH')) {
23
  define('ATLT_FILE', __FILE__);
24
  define('ATLT_URL', plugin_dir_url(ATLT_FILE));
25
  define('ATLT_PATH', plugin_dir_path(ATLT_FILE));
26
- define('ATLT_VERSION', '2.1');
27
 
28
  class LocoAutoTranslate
29
  {
@@ -164,7 +164,7 @@ class LocoAutoTranslate
164
  $plugin_info = get_plugin_data(__FILE__, true, true);
165
  echo '<div class="error"><p>' .
166
  sprintf(__('In order to use <strong>%s</strong> (version <strong>%s</strong>), Please update <a href="%s" class="thickbox" title="%s">%s</a> official plugin to a latest version (2.4.0 or upper)',
167
- 'loco-translate-addon'),
168
  $plugin_info['Name'], $plugin_info['Version'], esc_url($url),
169
  esc_attr($title), esc_attr($title)) . '.</p></div>';
170
 
@@ -181,7 +181,7 @@ class LocoAutoTranslate
181
  if (!function_exists('loco_plugin_self')) {
182
  add_action('admin_notices', array($this, 'atlt_plugin_required_admin_notice'));
183
  }
184
- load_plugin_textdomain('loco-translate-addon', false, basename(dirname(__FILE__)) . '/languages/');
185
  }
186
 
187
  /*
@@ -228,7 +228,7 @@ class LocoAutoTranslate
228
  $plugin_info = get_plugin_data(__FILE__, true, true);
229
  echo '<div class="error"><p>' .
230
  sprintf(__('In order to use <strong>%s</strong> plugin, please install and activate the latest version of <a href="%s" class="thickbox" title="%s">%s</a>',
231
- 'loco-translate-addon'),
232
  $plugin_info['Name'], esc_url($url),
233
  esc_attr($title), esc_attr($title)) . '.</p></div>';
234
 
@@ -262,7 +262,7 @@ class LocoAutoTranslate
262
  }
263
 
264
  }else{
265
- wp_register_script( 'loco-addon-custom', ATLT_URL.'assets/js/custom.min.js', array('loco-translate-js-admin'),ATLT_VERSION, true);
266
  wp_enqueue_script('loco-addon-custom');
267
  wp_register_style('loco-addon-custom-css', ATLT_URL.'assets/css/custom.min.css',null,
268
  ATLT_VERSION,'all');
@@ -304,12 +304,12 @@ function atlt_plugins_compatibility_check(){
304
  $loco = get_plugin_data( WP_PLUGIN_DIR . '/loco-translate/loco.php',false);
305
  $pages = array('loco-plugin');
306
 
307
- if( isset( $_GET['atlt_update'] ) && $_GET['atlt_update'] == true && version_compare($loco['Version'] ,'2.4.3','<' )){
308
 
309
  $_POST['key'] = (isset( $_GET['hash'] ) && !empty( $_GET['hash'] ) ) ? $_GET['hash'] : null;
310
  // forbid direct access.
311
  if( $_POST['key'] == null ){
312
- echo sprintf(__('<div class="error" style="padding:5px;margin-top:50px;">Nonce verification failed! Click to <a href="'. admin_url('admin.php?page='.$_GET['page']) . '">refresh</a> this page.</div>','loco-translate-addon'));
313
  die();
314
  }
315
  $response = wp_remote_get("https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=loco-translate", array('timeout'=>300) );
@@ -323,10 +323,10 @@ function atlt_plugins_compatibility_check(){
323
  $request = new Atlt_downloader();
324
  echo $request->rollback( $upgrade_link, "Loco Translate updated successful!" );
325
 
326
- echo sprintf(__('<br/><br/><a href="'. admin_url('admin.php?page='.$_GET['page']) . '">%s</a>','loco-translate-addon' ),'Refresh this page' );
327
  die();
328
 
329
- }else if( (isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'file-edit' ) && version_compare($loco['Version'] ,'2.4.3','<' ) ){
330
 
331
  $plugin_name = $atlt['Name'];
332
  // create nonce
@@ -334,9 +334,9 @@ function atlt_plugins_compatibility_check(){
334
  $url = admin_url( "admin.php?page=".$_GET['page']."&atlt_update=true&hash=" . $hash );
335
  echo '<div class="notice notice-error" style="margin-top:50px;">' .
336
  sprintf(__('<p style="font-size:16px;">
337
- <strong>Notice: %s</strong> is only compatible with Loco Translate latest version 2.4.3 or higher.
338
  </br><a class="button button-primary" href="'.$url.'" action="atlt_update" id="atlt_update">Update</a> Loco Translate official plugin to latest version to use this addon.</p></div>',
339
- 'loco-translate-addon') ,
340
  $plugin_name ) ;
341
 
342
  }
2
  /*
3
  Plugin Name:Automatic Translate Addon For Loco Translate
4
  Description:Auto language translator add-on for Loco Translate official plugin version 2.4.0 to translate plugins and themes translation files into any language via fully automatic machine translations via Yandex Translate Widget.
5
+ Version:2.1.1
6
  License:GPL2
7
+ Text Domain:automatic-translator-addon-for-loco-translate
8
  Domain Path:languages
9
  Author:Cool Plugins
10
  Author URI:https://coolplugins.net/
14
  use LocoAutoTranslateAddon\Helpers\Atlt_downloader;
15
  /**
16
  * @package Loco Automatic Translate Addon
17
+ * @version 2.1.1
18
  */
19
  if (!defined('ABSPATH')) {
20
  die('WordPress Environment Not Found!');
23
  define('ATLT_FILE', __FILE__);
24
  define('ATLT_URL', plugin_dir_url(ATLT_FILE));
25
  define('ATLT_PATH', plugin_dir_path(ATLT_FILE));
26
+ define('ATLT_VERSION', '2.1.1');
27
 
28
  class LocoAutoTranslate
29
  {
164
  $plugin_info = get_plugin_data(__FILE__, true, true);
165
  echo '<div class="error"><p>' .
166
  sprintf(__('In order to use <strong>%s</strong> (version <strong>%s</strong>), Please update <a href="%s" class="thickbox" title="%s">%s</a> official plugin to a latest version (2.4.0 or upper)',
167
+ 'automatic-translator-addon-for-loco-translate'),
168
  $plugin_info['Name'], $plugin_info['Version'], esc_url($url),
169
  esc_attr($title), esc_attr($title)) . '.</p></div>';
170
 
181
  if (!function_exists('loco_plugin_self')) {
182
  add_action('admin_notices', array($this, 'atlt_plugin_required_admin_notice'));
183
  }
184
+ load_plugin_textdomain('automatic-translator-addon-for-loco-translate', false, basename(dirname(__FILE__)) . '/languages/');
185
  }
186
 
187
  /*
228
  $plugin_info = get_plugin_data(__FILE__, true, true);
229
  echo '<div class="error"><p>' .
230
  sprintf(__('In order to use <strong>%s</strong> plugin, please install and activate the latest version of <a href="%s" class="thickbox" title="%s">%s</a>',
231
+ 'automatic-translator-addon-for-loco-translate'),
232
  $plugin_info['Name'], esc_url($url),
233
  esc_attr($title), esc_attr($title)) . '.</p></div>';
234
 
262
  }
263
 
264
  }else{
265
+ wp_register_script( 'loco-addon-custom', ATLT_URL.'assets/js/custom.js', array('loco-translate-js-admin'),ATLT_VERSION, true);
266
  wp_enqueue_script('loco-addon-custom');
267
  wp_register_style('loco-addon-custom-css', ATLT_URL.'assets/css/custom.min.css',null,
268
  ATLT_VERSION,'all');
304
  $loco = get_plugin_data( WP_PLUGIN_DIR . '/loco-translate/loco.php',false);
305
  $pages = array('loco-plugin');
306
 
307
+ if( isset( $_GET['atlt_update'] ) && $_GET['atlt_update'] == true && version_compare($loco['Version'] ,'2.4.4','<' )){
308
 
309
  $_POST['key'] = (isset( $_GET['hash'] ) && !empty( $_GET['hash'] ) ) ? $_GET['hash'] : null;
310
  // forbid direct access.
311
  if( $_POST['key'] == null ){
312
+ echo sprintf(__('<div class="error" style="padding:5px;margin-top:50px;">Nonce verification failed! Click to <a href="'. admin_url('admin.php?page='.$_GET['page']) . '">refresh</a> this page.</div>','automatic-translator-addon-for-loco-translate'));
313
  die();
314
  }
315
  $response = wp_remote_get("https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=loco-translate", array('timeout'=>300) );
323
  $request = new Atlt_downloader();
324
  echo $request->rollback( $upgrade_link, "Loco Translate updated successful!" );
325
 
326
+ echo sprintf(__('<br/><br/><a href="'. admin_url('admin.php?page='.$_GET['page']) . '">%s</a>','automatic-translator-addon-for-loco-translate' ),'Refresh this page' );
327
  die();
328
 
329
+ }else if( (isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'file-edit' ) && version_compare($loco['Version'] ,'2.4.4','<' ) ){
330
 
331
  $plugin_name = $atlt['Name'];
332
  // create nonce
334
  $url = admin_url( "admin.php?page=".$_GET['page']."&atlt_update=true&hash=" . $hash );
335
  echo '<div class="notice notice-error" style="margin-top:50px;">' .
336
  sprintf(__('<p style="font-size:16px;">
337
+ <strong>Notice: %s</strong> is only compatible with Loco Translate latest version 2.4.4 or higher.
338
  </br><a class="button button-primary" href="'.$url.'" action="atlt_update" id="atlt_update">Update</a> Loco Translate official plugin to latest version to use this addon.</p></div>',
339
+ 'automatic-translator-addon-for-loco-translate') ,
340
  $plugin_name ) ;
341
 
342
  }
readme.txt CHANGED
@@ -13,7 +13,7 @@ Automatic language translator add-on for Loco Translate official plugin to trans
13
 
14
  == Description ==
15
 
16
- > **Important Notice:-** This plugin works as an auto-translate addon for Loco Translate official plugin latest version(2.4.3 or higher).
17
 
18
  ### 🐦 Automatic Machine Translator Addon For Loco
19
 
@@ -62,9 +62,9 @@ Install this plugin along with the famous **[Loco Translate](https://wordpress.o
62
 
63
  **❗ Important Notice:** This addon only provides settings to use third party auto-translation widgets and services(Yandex, Google, DeepL etc.), it does not provide any translation service. So we don't guarantee 100% correctness, please check all translated text carefully before making it live on your production site. If any auto-translate provider stops providing auto-translation widget or service in future, in that case plugin will not support that translation provider.
64
 
65
- **🎬 Unlimited Translations(no API)**
66
 
67
- https://youtu.be/UdT6lRg_IHA
68
 
69
  > “Many people make the mistake of saving money by wasting time.”
70
 
@@ -134,6 +134,11 @@ There is no limit. Yes, you can translate unlimited characters without any API k
134
  5. Premium License Pricing
135
 
136
  == Changelog ==
 
 
 
 
 
137
  <strong>Version 2.1 | 14 OCT 2020</strong>
138
  <pre>
139
  Added: integrated new Auto Translation
@@ -142,6 +147,7 @@ Fixed: compatibility issues with Loco Translate
142
  Improved: removed Extra Code
143
  Improved: improved custom.js
144
  </pre>
 
145
  <strong>Version 2.0.1 | 07 AUG 2020</strong>
146
  <pre>
147
  Notice Added: Addon is currently compatible with only Loco Translate official plugin version 2.4.0, new compatible update will available soon.
13
 
14
  == Description ==
15
 
16
+ > **Important Notice:-** This plugin works as an auto-translate addon for Loco Translate official plugin latest version(2.4.4 or higher).
17
 
18
  ### 🐦 Automatic Machine Translator Addon For Loco
19
 
62
 
63
  **❗ Important Notice:** This addon only provides settings to use third party auto-translation widgets and services(Yandex, Google, DeepL etc.), it does not provide any translation service. So we don't guarantee 100% correctness, please check all translated text carefully before making it live on your production site. If any auto-translate provider stops providing auto-translation widget or service in future, in that case plugin will not support that translation provider.
64
 
65
+ **🎬 Unlimited Translations(no API) - Pro Version Video**
66
 
67
+ https://youtu.be/RkVwHB3hppo
68
 
69
  > “Many people make the mistake of saving money by wasting time.”
70
 
134
  5. Premium License Pricing
135
 
136
  == Changelog ==
137
+ <strong>Version 2.1.1 | 27 OCT 2020</strong>
138
+ <pre>
139
+ Fixed: Compatibility issues with Loco Translate 2.4.4
140
+ </pre>
141
+
142
  <strong>Version 2.1 | 14 OCT 2020</strong>
143
  <pre>
144
  Added: integrated new Auto Translation
147
  Improved: removed Extra Code
148
  Improved: improved custom.js
149
  </pre>
150
+
151
  <strong>Version 2.0.1 | 07 AUG 2020</strong>
152
  <pre>
153
  Notice Added: Addon is currently compatible with only Loco Translate official plugin version 2.4.0, new compatible update will available soon.