Language in progress

This commit is contained in:
Claude Brisson
2023-06-12 20:25:21 +02:00
parent 82bb0115ae
commit cc0e42eb5a
4 changed files with 35 additions and 9 deletions

View File

@@ -3,13 +3,23 @@ package org.jeudego.pairgoth.view
import org.apache.velocity.tools.config.ValidScope import org.apache.velocity.tools.config.ValidScope
import org.jeudego.pairgoth.util.Translator import org.jeudego.pairgoth.util.Translator
@ValidScope("request") @ValidScope("application")
class TranslationTool { class TranslationTool {
fun translate(enText: String): String { fun translate(enText: String): String {
return translator.get().translate(enText) 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 { companion object {
val translator = ThreadLocal<Translator>() val translator = ThreadLocal<Translator>()
} }

View File

@@ -2,11 +2,12 @@
@layer pairgoth { @layer pairgoth {
body { body {
font-size : clamp(1rem, 3vw, 3rem); font-size : clamp(1rem, 2vw, 3rem);
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow: hidden;
} }
.flex { .flex {
@@ -22,13 +23,18 @@
} }
#header { #header {
height: 2em; height: 3em;
width: 100%; width: 100%;
position: relative; position: relative;
justify-content: space-between; justify-content: space-between;
#left-header, #right-header { #left-header {
height: 100%; height: 100%;
} }
#right-header {
height: 100%;
margin-top: 0.5em;
margin-right: 0.5em;
}
#logo { #logo {
height: 100%; height: 100%;
img { img {
@@ -40,15 +46,19 @@
#center { #center {
max-width: clamp(800px, 80vw, 100vw); max-width: clamp(800px, 80vw, 100vw);
margin-left: auto;
margin-right: auto;
flex: 1; flex: 1;
overflow: auto;
#inner {
display: flex;
flex-flow: column nowrap;
align-items: center;
}
} }
#footer { #footer {
flex: 0; flex: 0;
height: 2em; height: 2em;
margin: 0 2em; margin: 0 0.5em;
font-size: 0.8em; font-size: 0.8em;
justify-content: space-between; justify-content: space-between;
} }
@@ -57,6 +67,10 @@
padding: 0.5em; padding: 0.5em;
} }
button {
font-size: inherit;
}
button.floating { button.floating {
box-shadow: 0px 8px 8px -5px rgba(0,0,0,35%); box-shadow: 0px 8px 8px -5px rgba(0,0,0,35%);
transition: all 0.3s; transition: all 0.3s;

View File

@@ -17,12 +17,14 @@
</div> </div>
</div> </div>
<div id="right-header"> <div id="right-header">
[flag] <i class="$translate.flags[$request.lang] flag"></i>
</div> </div>
</div> </div>
<div id="center"> <div id="center">
<div id="inner">
#translate($page) #translate($page)
</div> </div>
</div>
<div id="footer" class="horz flex"> <div id="footer" class="horz flex">
<div id="version">pairgoth v0.1</div> <div id="version">pairgoth v0.1</div>
<div id="contact"><a href="mailto:pairgoth@jeudego.org">contact</a></div> <div id="contact"><a href="mailto:pairgoth@jeudego.org">contact</a></div>

View File

@@ -2,6 +2,7 @@
<tools xmlns:xi="http://www.w3.org/2001/XInclude"> <tools xmlns:xi="http://www.w3.org/2001/XInclude">
<toolbox scope="application"> <toolbox scope="application">
<tool key="translate" class="org.jeudego.pairgoth.view.TranslationTool"/>
<!-- <!--
<tool key="number" format="#0.00"/> <tool key="number" format="#0.00"/>
<tool key="date" locale="fr_FR" format="yyyy-MM-dd"/> <tool key="date" locale="fr_FR" format="yyyy-MM-dd"/>
@@ -17,7 +18,6 @@
</toolbox> </toolbox>
<toolbox scope="request"> <toolbox scope="request">
<tool key="translate" class="org.jeudego.pairgoth.view.TranslationTool"/>
<tool key="api" class="org.jeudego.pairgoth.view.ApiTool"/> <tool key="api" class="org.jeudego.pairgoth.view.ApiTool"/>
</toolbox> </toolbox>