Add en-US translations
This commit is contained in:
parent
31b92da6ce
commit
bd01a35cc6
45 changed files with 539 additions and 158 deletions
|
@ -18,6 +18,7 @@
|
|||
import { get } from "svelte/store";
|
||||
import type { Unsubscriber } from "svelte/store";
|
||||
import { sendMenuClickedEvent } from "../../Api/iframe/Ui/MenuItem";
|
||||
import { translator } from "../../Translator/Translator";
|
||||
|
||||
let activeSubMenu: string = SubMenusInterface.profile;
|
||||
let activeComponent: typeof ProfileSubMenu | typeof CustomSubMenu = ProfileSubMenu;
|
||||
|
@ -82,18 +83,26 @@
|
|||
function closeMenu() {
|
||||
menuVisiblilityStore.set(false);
|
||||
}
|
||||
|
||||
function onKeyDown(e: KeyboardEvent) {
|
||||
if (e.key === "Escape") {
|
||||
closeMenu();
|
||||
}
|
||||
}
|
||||
|
||||
function translateMenuName(menuName: string) {
|
||||
const nameFormatted = "menu.sub." + menuName.toLowerCase().replaceAll(" ", "-");
|
||||
const translation = translator._(nameFormatted);
|
||||
|
||||
return translation === nameFormatted ? menuName : translation;
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={onKeyDown} />
|
||||
|
||||
<div class="menu-container-main">
|
||||
<div class="menu-nav-sidebar nes-container is-rounded" transition:fly={{ x: -1000, duration: 500 }}>
|
||||
<h2>Menu</h2>
|
||||
<h2>{translator._("menu.title")}</h2>
|
||||
<nav>
|
||||
{#each $subMenusStore as submenu}
|
||||
<button
|
||||
|
@ -101,14 +110,14 @@
|
|||
class="nes-btn {activeSubMenu === submenu ? 'is-disabled' : ''}"
|
||||
on:click|preventDefault={() => switchMenu(submenu)}
|
||||
>
|
||||
{submenu}
|
||||
{translateMenuName(submenu)}
|
||||
</button>
|
||||
{/each}
|
||||
</nav>
|
||||
</div>
|
||||
<div class="menu-submenu-container nes-container is-rounded" transition:fly={{ y: -1000, duration: 500 }}>
|
||||
<button type="button" class="nes-btn is-error close" on:click={closeMenu}>×</button>
|
||||
<h2>{activeSubMenu}</h2>
|
||||
<h2>{translateMenuName(activeSubMenu)}</h2>
|
||||
<svelte:component this={activeComponent} {...props} />
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue