From cc0e42eb5a22e154956cd089e3ab5fe055b4272e Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Mon, 12 Jun 2023 20:25:21 +0200 Subject: [PATCH] Language in progress --- .../jeudego/pairgoth/view/TranslationTool.kt | 12 ++++++++- view-webapp/src/main/sass/main.scss | 26 ++++++++++++++----- .../main/webapp/WEB-INF/layouts/standard.html | 4 ++- view-webapp/src/main/webapp/WEB-INF/tools.xml | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/TranslationTool.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/TranslationTool.kt index 8da62a2..552bbcf 100644 --- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/TranslationTool.kt +++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/TranslationTool.kt @@ -3,13 +3,23 @@ package org.jeudego.pairgoth.view import org.apache.velocity.tools.config.ValidScope import org.jeudego.pairgoth.util.Translator -@ValidScope("request") +@ValidScope("application") class TranslationTool { fun translate(enText: String): String { return translator.get().translate(enText) } + val languages = Translator.providedLanguages + + val flags = Translator.providedLanguages.associate { iso -> + when (iso) { + "en" -> "gb uk" + "zh" -> "cn" + else -> iso + }.let { Pair(iso, it) } + } + companion object { val translator = ThreadLocal() } diff --git a/view-webapp/src/main/sass/main.scss b/view-webapp/src/main/sass/main.scss index c3eb2b8..70e076e 100644 --- a/view-webapp/src/main/sass/main.scss +++ b/view-webapp/src/main/sass/main.scss @@ -2,11 +2,12 @@ @layer pairgoth { body { - font-size : clamp(1rem, 3vw, 3rem); + font-size : clamp(1rem, 2vw, 3rem); width: 100vw; height: 100vh; margin: 0; padding: 0; + overflow: hidden; } .flex { @@ -22,13 +23,18 @@ } #header { - height: 2em; + height: 3em; width: 100%; position: relative; justify-content: space-between; - #left-header, #right-header { + #left-header { height: 100%; } + #right-header { + height: 100%; + margin-top: 0.5em; + margin-right: 0.5em; + } #logo { height: 100%; img { @@ -40,15 +46,19 @@ #center { max-width: clamp(800px, 80vw, 100vw); - margin-left: auto; - margin-right: auto; flex: 1; + overflow: auto; + #inner { + display: flex; + flex-flow: column nowrap; + align-items: center; + } } #footer { flex: 0; height: 2em; - margin: 0 2em; + margin: 0 0.5em; font-size: 0.8em; justify-content: space-between; } @@ -57,6 +67,10 @@ padding: 0.5em; } + button { + font-size: inherit; + } + button.floating { box-shadow: 0px 8px 8px -5px rgba(0,0,0,35%); transition: all 0.3s; diff --git a/view-webapp/src/main/webapp/WEB-INF/layouts/standard.html b/view-webapp/src/main/webapp/WEB-INF/layouts/standard.html index bc2c1cc..52c48f2 100644 --- a/view-webapp/src/main/webapp/WEB-INF/layouts/standard.html +++ b/view-webapp/src/main/webapp/WEB-INF/layouts/standard.html @@ -17,11 +17,13 @@
- [flag] +
+
#translate($page) +