From b0fefb4690b305bca8cf5a3d67fd633efe337bbd Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 26 Feb 2022 02:59:04 +0100 Subject: [PATCH] Support localized menu strings + improved some css for menus --- web/src/_templates/app/js.php | 3 ++- web/src/app/css/app.css | 12 ++++++++++++ web/src/app/js/app.js | 3 +++ web/src/config/lang/en.php | 3 +++ web/src/config/lang/es.php | 3 +++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/web/src/_templates/app/js.php b/web/src/_templates/app/js.php index 614bca1..0f17fe6 100644 --- a/web/src/_templates/app/js.php +++ b/web/src/_templates/app/js.php @@ -28,7 +28,8 @@ app.menus = { position: 'left', maxwidth: 35, items: [ - { text: 'Test', onclick: "alert('test')", fa: 'times' }, + { text: 's:nav.profile', fa: 'user', + onclick: "alert('user')" }, { separator: true }, ], }, diff --git a/web/src/app/css/app.css b/web/src/app/css/app.css index 5ef8f2f..75be6f1 100644 --- a/web/src/app/css/app.css +++ b/web/src/app/css/app.css @@ -48,9 +48,21 @@ fieldset label > * { #menu-container.left .component.button { text-align: right !important; } +#menu-container.left .component.button .fa { + margin-left: .5em; +} #menu-container.right .component.button { text-align: left !important; } +#menu-container.right .component.button { + margin-right: .5em; +} +#menu-container .component.button > * { + vertical-align: middle; +} +#menu-container .component.button .fa { + font-size: 1.5em; +} #menu-container #menu .button { padding: 1em; } diff --git a/web/src/app/js/app.js b/web/src/app/js/app.js index 8dab961..38142ba 100644 --- a/web/src/app/js/app.js +++ b/web/src/app/js/app.js @@ -40,6 +40,9 @@ app.menu = { var content = ''; for (var i = 0; i < items.length; i++) { var item = items[i]; + if (typeof item.text === 'string') + if (item.text.startsWith('s:')) + item.text = s(item.text.substr(2)); item.displayIconRight = 'none'; item.displayIconLeft = 'none'; if (item.fa !== undefined) diff --git a/web/src/config/lang/en.php b/web/src/config/lang/en.php index 801244c..c4b1dd7 100644 --- a/web/src/config/lang/en.php +++ b/web/src/config/lang/en.php @@ -7,6 +7,9 @@ $strings = [ 'nav_close' => 'Close this window', 'action_quiz' => 'Fill the quiz requested by your crush', ], + 'nav' => [ + 'profile' => 'Profile', + ], 'form' => [ 'login' => 'Log in', 'email' => 'E-mail', diff --git a/web/src/config/lang/es.php b/web/src/config/lang/es.php index 6b9a8fe..b3397bf 100644 --- a/web/src/config/lang/es.php +++ b/web/src/config/lang/es.php @@ -7,6 +7,9 @@ $strings = [ 'nav_close' => 'Cerrar esta ventana', 'action_quiz' => 'Rellena el quiz que te ha pedido tu crush', ], + 'nav' => [ + 'profile' => 'Perfil', + ], 'form' => [ 'login' => 'Iniciar sesiĆ³n', 'email' => 'E-mail',