Get ready for localization

This commit is contained in:
Ethan O'Brien 2023-07-03 11:09:19 -05:00
parent 96ad084485
commit 8e11813dd5

View file

@ -298,6 +298,7 @@ class EmulatorJS {
this.elements.parent.appendChild(this.textElem); this.elements.parent.appendChild(this.textElem);
} }
localization(text) { localization(text) {
//return "-";
//todo //todo
return text; return text;
} }
@ -818,7 +819,7 @@ class EmulatorJS {
popup.classList.add("ejs_popup_container"); popup.classList.add("ejs_popup_container");
this.elements.parent.appendChild(popup); this.elements.parent.appendChild(popup);
const title = this.createElement("h4"); const title = this.createElement("h4");
title.innerText = popupTitle; title.innerText = this.localization(popupTitle);
const main = this.createElement("div"); const main = this.createElement("div");
main.classList.add("ejs_popup_body"); main.classList.add("ejs_popup_body");
@ -834,7 +835,7 @@ class EmulatorJS {
}); });
} }
button.classList.add("ejs_button"); button.classList.add("ejs_button");
button.innerText = k; button.innerText = this.localization(k);
popup.appendChild(button); popup.appendChild(button);
} }
if (!hidden) { if (!hidden) {
@ -907,7 +908,7 @@ class EmulatorJS {
svg.setAttribute("focusable", "false"); svg.setAttribute("focusable", "false");
svg.innerHTML = image; svg.innerHTML = image;
const text = this.createElement("span"); const text = this.createElement("span");
text.innerText = title; text.innerText = this.localization(title);
text.classList.add("ejs_menu_text"); text.classList.add("ejs_menu_text");
button.classList.add("ejs_menu_button"); button.classList.add("ejs_menu_button");
@ -1239,7 +1240,7 @@ class EmulatorJS {
size.innerText = getSize(roms[k]); size.innerText = getSize(roms[k]);
const a = this.createElement("a"); const a = this.createElement("a");
a.innerText = "Remove"; a.innerText = this.localization("Remove");
this.addEventListener(remove, "click", () => { this.addEventListener(remove, "click", () => {
this.storage.rom.remove(k); this.storage.rom.remove(k);
line.remove(); line.remove();
@ -1317,7 +1318,7 @@ class EmulatorJS {
playerContainer.classList.add("tabs-title"); playerContainer.classList.add("tabs-title");
playerContainer.setAttribute("role", "presentation"); playerContainer.setAttribute("role", "presentation");
const player = this.createElement("a"); const player = this.createElement("a");
player.innerText = "Player "+i; player.innerText = this.localization("Player")+" "+i;
player.setAttribute("role", "tab"); player.setAttribute("role", "tab");
player.setAttribute("aria-controls", "controls-"+(i-1)); player.setAttribute("aria-controls", "controls-"+(i-1));
player.setAttribute("aria-selected", "false"); player.setAttribute("aria-selected", "false");
@ -1442,7 +1443,7 @@ class EmulatorJS {
setButton.style = "width:25%;float:left;"; setButton.style = "width:25%;float:left;";
const button = this.createElement("a"); const button = this.createElement("a");
button.classList.add("ejs_control_set_button"); button.classList.add("ejs_control_set_button");
button.innerText = "Set"; button.innerText = this.localization("Set");
setButton.appendChild(button); setButton.appendChild(button);
const padding2 = this.createElement("div"); const padding2 = this.createElement("div");
@ -2260,13 +2261,13 @@ class EmulatorJS {
if (window.EJS_SHADERS) { if (window.EJS_SHADERS) {
addToMenu(this.localization('Shaders'), 'shader', { addToMenu(this.localization('Shaders'), 'shader', {
'disabled': "Disabled", 'disabled': this.localization("Disabled"),
'2xScaleHQ.glslp': "2xScaleHQ", '2xScaleHQ.glslp': this.localization("2xScaleHQ"),
'4xScaleHQ.glslp': "4xScaleHQ", '4xScaleHQ.glslp': this.localization("4xScaleHQ"),
'crt-easymode.glslp': 'CRT easymode', 'crt-easymode.glslp': this.localization('CRT easymode'),
'crt-aperture.glslp': 'CRT aperture', 'crt-aperture.glslp': this.localization('CRT aperture'),
'crt-geom.glslp': 'CRT geom', 'crt-geom.glslp': this.localization('CRT geom'),
'crt-mattias.glslp': 'CRT mattias' 'crt-mattias.glslp': this.localization('CRT mattias')
}, 'disabled'); }, 'disabled');
} }
@ -2318,7 +2319,7 @@ class EmulatorJS {
const header = this.createElement("div"); const header = this.createElement("div");
header.classList.add("ejs_cheat_header"); header.classList.add("ejs_cheat_header");
const title = this.createElement("h2"); const title = this.createElement("h2");
title.innerText = "Add Cheat Code"; title.innerText = this.localization("Add Cheat Code");
title.classList.add("ejs_cheat_heading"); title.classList.add("ejs_cheat_heading");
const close = this.createElement("button"); const close = this.createElement("button");
close.classList.add("ejs_cheat_close"); close.classList.add("ejs_cheat_close");
@ -2332,7 +2333,7 @@ class EmulatorJS {
const main = this.createElement("div"); const main = this.createElement("div");
main.classList.add("ejs_cheat_main"); main.classList.add("ejs_cheat_main");
const header3 = this.createElement("strong"); const header3 = this.createElement("strong");
header3.innerText = "Code"; header3.innerText = this.localization("Code");
main.appendChild(header3); main.appendChild(header3);
main.appendChild(this.createElement("br")); main.appendChild(this.createElement("br"));
const mainText = this.createElement("textarea"); const mainText = this.createElement("textarea");
@ -2342,7 +2343,7 @@ class EmulatorJS {
main.appendChild(mainText); main.appendChild(mainText);
main.appendChild(this.createElement("br")); main.appendChild(this.createElement("br"));
const header2 = this.createElement("strong"); const header2 = this.createElement("strong");
header2.innerText = "Description"; header2.innerText = this.localization("Description");
main.appendChild(header2); main.appendChild(header2);
main.appendChild(this.createElement("br")); main.appendChild(this.createElement("br"));
const mainText2 = this.createElement("input"); const mainText2 = this.createElement("input");
@ -2355,8 +2356,8 @@ class EmulatorJS {
const footer = this.createElement("footer"); const footer = this.createElement("footer");
const submit = this.createElement("button"); const submit = this.createElement("button");
const closeButton = this.createElement("button"); const closeButton = this.createElement("button");
submit.innerText = "Submit"; submit.innerText = this.localization("Submit");
closeButton.innerText = "Close"; closeButton.innerText = this.localization("Close");
submit.classList.add("ejs_button_button"); submit.classList.add("ejs_button_button");
closeButton.classList.add("ejs_button_button"); closeButton.classList.add("ejs_button_button");
submit.classList.add("ejs_popup_submit"); submit.classList.add("ejs_popup_submit");