summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-12-03 12:37:51 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-12-03 12:37:51 +0100
commit39ffb2c653c4940a9cc12fcd15500e53a90772ae (patch)
treeefdb2106ffeaf741fe7aa8dff6ba8a7cd6010475
parenta702051aef4b32fca7fd516a34415fcbb1e8c871 (diff)
add language switcher
-rw-r--r--lib/DBInfoscreen.pm14
-rw-r--r--templates/layouts/app.html.ep3
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm
index c8960c9..4bf1eea 100644
--- a/lib/DBInfoscreen.pm
+++ b/lib/DBInfoscreen.pm
@@ -61,7 +61,19 @@ sub startup {
for my $cookie ( @{ $self->req->cookies } ) {
if ( $cookie->name eq 'theme' ) {
$self->session( theme => $cookie->value );
- return;
+ say 'found theme ' . $cookie->value;
+ }
+ elsif ( $cookie->name eq 'lang' ) {
+ my $l = $cookie->value;
+ if ( $l eq 'de' or $l eq 'en' ) {
+ $self->languages($l);
+ }
+ }
+ }
+
+ if ( my $l = $self->param('lang') ) {
+ if ( $l eq 'de' or $l eq 'en' ) {
+ $self->languages($l);
}
}
}
diff --git a/templates/layouts/app.html.ep b/templates/layouts/app.html.ep
index 7e8e38a..6d18f8b 100644
--- a/templates/layouts/app.html.ep
+++ b/templates/layouts/app.html.ep
@@ -294,14 +294,13 @@ Theme:
<a onClick="javascript:setTheme('light')">light</a>
·
<a onClick="javascript:setTheme('default')">device theme</a>
-<!--<br/>
+<br/>
Language:
<a onClick="javascript:setLang('de')">DE</a>
·
<a onClick="javascript:setLang('en')">EN</a>
·
<a onClick="javascript:setLang('default')">system language</a>
-<br/>-->
</div>
<div class="about">
<a href="_about">DBF</a> v<%= stash('version') // '???' %>