(function(ACLocalization,$,undefined){ACLocalization.init=function(){var _language,_theme;if(typeof jQuery==="undefined"){console.log(">>> delayed load for ac.localization.js");window.setTimeout(UIACLocalization.init,250);return;}
var lDb={"neutral":neutralLanguage,"en":en,"de":(typeof(de)!=="undefined")?de:{language:"Deutsch"},"es":(typeof(es)!=="undefined")?es:{language:"Español"},"fr":(typeof(fr)!=="undefined")?fr:{language:"Français"},"it":(typeof(it)!=="undefined")?it:{language:"Italiano"},"zh":(typeof(zh)!=="undefined")?zh:{language:"简体中文"}};function htmlEscape(str){return String(str).replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}
$.setLanguage=function(language,theme,selector){if(!language)language="neutral";_language=language;if(lDb[language]){$(document).trigger("languageChanged",[language]);var sel=(selector?selector+" ":"")+"l18n";$(sel).each(function(){var $this=$(this);var tagid=$this.attr("t"),content=$this.text().trim(),taglang=$this.attr("l");if(!tagid)tagid=content;var value=lDb[language][htmlEscape(tagid)];if(!value)value=lDb["neutral"][htmlEscape(tagid)];if(!value)value=htmlEscape((content.length>0&&content==tagid)||tagid.indexOf("$")==0?content:tagid);if(content.indexOf("{")!=0)
$this.replaceWith($("<l18n/>",{"t":tagid,html:value.replace('\n','<br />'),"l":language}));});if(!theme)return;_theme=theme;$.ACCall("uimessage","msg=Applying localization - "+language);console.log("Setting up localization UI");$("html").addClass("language_"+language);}};$(document).on("click","l18n",function(e){if($(this).hasClass("l18nHighlight")){e.stopPropagation();e.preventDefault();var $this=$(this);var l=$this.attr("t");var v=$this.html();$(".textinputmodal .title").text(_language+":"+l);$(".textinputmodal .subtext").text(v);$(".textinputmodal textarea").val(v.replace("<br>","\n"));$(".textinputmodal").addClass("active").focus();$(".textinputmodal #ok").data("onclick",function(){var s=$(".textinputmodal textarea").val().replace("\n","<br/>");lDb[_language][htmlEscape(l)]=$(".textinputmodal textarea").val();$this.html(s);console.log("Saving translation for language \""+_language+"\" of "+_theme+" theme.");$.post("http://ac/savetofile/"+_theme+"/js/ac.localization."+_language+".js",{"location":"appdata","data":"var "+_language+"="+encodeURIComponent(JSON.stringify(lDb[_language]).replace(/\",\"/g,"\",\n\t\""))+";"});$(".textinputmodal").removeClass("active");});return false;}});$.getl18n=function(valuestring,language){if(!language)language=_language;if(!language)language="neutral";if(lDb[language]){var value=lDb[language][htmlEscape(valuestring)];if(!value)value=lDb["neutral"][htmlEscape(valuestring)];if(!value)value=htmlEscape(valuestring);return value;}
return false;};};ACLocalization.init();console.log("ACLocalization init");})(window.ACLocalization=window.ACLocalization||{},jQuery);