diff --git a/.gitignore b/.gitignore index 54747e6..94a403b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ roms/ yarn.lock package-lock.json +.vscode/settings.json diff --git a/data/emulator.js b/data/emulator.js index 31f0efa..a2ffbdb 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -234,6 +234,7 @@ class EmulatorJS { this.debug = (window.EJS_DEBUG_XX === true); if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates(); this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true); + this.settingsLanguage = window.EJS_settingsLanguage || false; this.config = config; this.currentPopup = null; this.isFastForward = false; @@ -413,10 +414,14 @@ class EmulatorJS { this.textElem.innerText = this.localization("Loading..."); this.elements.parent.appendChild(this.textElem); } - localization(text) { + localization(text, log) { if (!isNaN(text)) return text; + if (text.includes("EmulatorJS v")) return text; if (this.config.langJson) { - if (!this.config.langJson[text]) { + if (typeof log === "undefined") log = true; + if (!this.config.langJson[text] && log) { + if(!window.EJS_missingLang) window.EJS_missingLang = []; + window.EJS_missingLang.push(text); console.log("Translation not found for '"+text+"'. Language set to '"+this.config.language+"'"); } return this.config.langJson[text] || text; @@ -1075,7 +1080,7 @@ class EmulatorJS { } a.href = "#"; a.onclick = "return false"; - a.innerText = title; + a.innerText = this.localization(title); li.appendChild(a); parent.appendChild(li); hideMenu(); @@ -1134,7 +1139,7 @@ class EmulatorJS { } a.href = "#"; a.onclick = "return false"; - a.innerText = title; + a.innerText = this.localization(title); li.appendChild(a); parent.appendChild(li); hideMenu(); @@ -3404,9 +3409,9 @@ class EmulatorJS { if (options.length === 1) return; let availableOptions = {}; for (let i=0; i 1) ? name.split("|")[1] : options[0].replace('(Default) ', '')); }) diff --git a/data/emulator.min.js b/data/emulator.min.js index b7e077d..a783142 100644 --- a/data/emulator.min.js +++ b/data/emulator.min.js @@ -1 +1,2 @@ -!function(){var e,t;e=window,t=function(){return n=[function(e,t,n){"use strict";n.r(t);function _(e,t){var n=t.x-e.x,t=t.y-e.y;return Math.sqrt(n*n+t*t)}function b(e){return e*(Math.PI/180)}function o(e){f.has(e)&&clearTimeout(f.get(e)),f.set(e,setTimeout(e,100))}function s(e,t,n){for(var i,o=t.split(/[ ,]+/g),s=0;sthis.options.threshold){var r,l={};for(r in this.direction)this.direction.hasOwnProperty(r)&&(l[r]=this.direction[r]);var c={};for(r in this.direction={x:n,y:i,angle:t},e.direction=this.direction,l)l[r]===this.direction[r]&&(c[r]=!0);if(c.x&&c.y&&c.angle)return e;c.x&&c.y||this.trigger("plain",e),c.x||this.trigger("plain:"+n,e),c.y||this.trigger("plain:"+i,e),c.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var x=w;function E(e,t){this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=e,this.id=E.id,E.id+=1,this.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},this.config(t),"static"!==this.options.mode&&"semi"!==this.options.mode||(this.options.multitouch=!1),this.options.multitouch||(this.options.maxNumberOfNipples=1);e=getComputedStyle(this.options.zone.parentElement);return e&&"flex"===e.display&&(this.parentIsFlex=!0),this.updateBox(),this.prepareNipples(),this.bindings(),this.begin(),this.nipples}E.prototype=new m,(E.constructor=E).id=0,E.prototype.prepareNipples=function(){var i=this.nipples;i.on=this.on.bind(this),i.off=this.off.bind(this),i.options=this.options,i.destroy=this.destroy.bind(this),i.ids=this.ids,i.id=this.id,i.processOnMove=this.processOnMove.bind(this),i.processOnEnd=this.processOnEnd.bind(this),i.get=function(e){if(void 0===e)return i[0];for(var t=0,n=i.length;t