From 6c552af10823c69dc740fea696622d543e297a1e Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 27 Mar 2024 18:43:31 +0100 Subject: Remove I18N for now. It's incompatible with caching proxy setups. --- cpanfile | 1 - lib/DBInfoscreen.pm | 18 --------- lib/DBInfoscreen/Controller/Stationboard.pm | 12 +++--- lib/DBInfoscreen/Controller/Wagenreihung.pm | 6 +-- templates/_map_infobox.html.ep | 34 ++++++++--------- templates/_train_details.html.ep | 44 +++++++++++----------- templates/landingpage.html.ep | 6 +-- templates/layouts/app.html.ep | 57 +++++++++++++++-------------- templates/route_map.html.ep | 2 +- templates/wagen.html.ep | 6 +-- templates/wagenreihung.html.ep | 6 +-- 11 files changed, 87 insertions(+), 105 deletions(-) diff --git a/cpanfile b/cpanfile index 248b3eb..ce057eb 100644 --- a/cpanfile +++ b/cpanfile @@ -10,7 +10,6 @@ requires 'List::UtilsBy'; requires 'LWP::UserAgent'; requires 'LWP::Protocol::https'; requires 'Mojolicious'; -requires 'Mojolicious::Plugin::I18N'; requires 'Travel::Status::DE::DBWagenreihung', '0.06'; requires 'Travel::Status::DE::HAFAS', '>= 5.03'; requires 'Travel::Status::DE::IRIS'; diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index a3f22bf..c33a703 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -38,12 +38,6 @@ sub startup { chomp $self->config->{version}; $self->defaults( version => $self->config->{version} // 'UNKNOWN' ); - $self->plugin( - I18N => { - default => 'de', - }, - ); - # Generally, the reverse proxy handles compression. # Also, Mojolicious compression breaks legacy callback-based JSON endpoints # for some clients. @@ -62,18 +56,6 @@ sub startup { if ( $cookie->name eq 'theme' ) { $self->session( 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/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 757790d..cff1ff8 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -833,9 +833,9 @@ sub render_train { my %opt = ( train => $result ); - if ( $self->languages =~ m{^en} ) { - $opt{language} = 'en'; - } + #if ( $self->languages =~ m{^en} ) { + # $opt{language} = 'en'; + #} $self->hafas->get_route_p(%opt)->then( sub { @@ -1117,9 +1117,9 @@ sub train_details { $opt{service} = $hafas; } - if ( $self->languages =~ m{^en} ) { - $opt{language} = 'en'; - } + #if ( $self->languages =~ m{^en} ) { + # $opt{language} = 'en'; + #} if ( my $date = $self->param('date') ) { if ( $date diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm index 35df7a2..1708285 100644 --- a/lib/DBInfoscreen/Controller/Wagenreihung.pm +++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm @@ -225,15 +225,15 @@ sub wagen { ); } - my $title = $self->l('Wagen ') . $wagon_id; + my $title = 'Wagen ' . $wagon_id; if ( $wref->{tt} and $wref->{tn} ) { $title = sprintf( '%s %s', $wref->{tt}, $wref->{tn} ); if ($wagon_no) { - $title .= ' ' . $self->l('Wagen ') . $wagon_no; + $title .= ' Wagen ' . $wagon_no; } else { - $title .= ' ' . $self->l('Wagen ') . $wagon_id; + $title .= ' Wagen ' . $wagon_id; } } diff --git a/templates/_map_infobox.html.ep b/templates/_map_infobox.html.ep index 4f9a644..7372802 100644 --- a/templates/_map_infobox.html.ep +++ b/templates/_map_infobox.html.ep @@ -4,40 +4,40 @@ data-req="<%= stash('ajax_req') =~ s{#}{%23}gr %>" data-route="<%= stash('ajax_route') %>" data-poly="<%= stash('ajax_polyline') %>" > - %= l 'Fahrt' + Fahrt % if (stash('train_no')) { <%= stash('train_no') %> % } - <%= l 'von' %> <%= stash('origin')->{name} %> - <%= l 'nach' %> <%= stash('destination')->{name} %> + von <%= stash('origin')->{name} %> + nach <%= stash('destination')->{name} %> % if (my $next = stash('next_stop')) {
% if ($next->{type} eq 'present' and $next->{station}{dep} and $next->{station}{arr}) { - <%= l 'Aufenthalt in' %> <%= $next->{station}->loc->name %> + Aufenthalt in <%= $next->{station}->loc->name %> % if ($next->{station}{platform}) { - <%= l 'an Gleis' %> <%= $next->{station}{platform} %> + an Gleis <%= $next->{station}{platform} %> % } - <%= l 'bis' %> <%= $next->{station}{dep}->strftime('%H:%M') %> + bis <%= $next->{station}{dep}->strftime('%H:%M') %> % if ($next->{station}{dep_delay}) { %= sprintf('(%+d)', $next->{station}{dep_delay}) % } % } % elsif ($next->{type} eq 'present' and $next->{station}{dep}) { - <%= l 'Abfahrt in' %> <%= $next->{station}->loc->name %> + Abfahrt in <%= $next->{station}->loc->name %> % if ($next->{station}{platform}) { - <%= l 'von Gleis' %> <%= $next->{station}{platform} %> + von Gleis <%= $next->{station}{platform} %> % } - <%= l 'um' %> <%= $next->{station}{dep}->strftime('%H:%M') %> + um <%= $next->{station}{dep}->strftime('%H:%M') %> % if ($next->{station}{dep_delay}) { %= sprintf('(%+d)', $next->{station}{dep_delay}) % } % } % elsif ($next->{type} eq 'present' and $next->{station}{arr}) { - %= l 'Endstation erreicht um' + Endstation erreicht um <%= $next->{station}{arr}->strftime('%H:%M') %> % if ($next->{station}{platform}) { - <%= l 'auf Gleis' %> <%= $next->{station}{platform} %> + auf Gleis <%= $next->{station}{platform} %> % } % if ($next->{station}{arr_delay}) { %= sprintf('(%+d)', $next->{station}{arr_delay}) @@ -47,25 +47,25 @@ data-poly="<%= stash('ajax_polyline') %>" Zug steht in <%= $next->{station}{arr}->strftime('%H:%M') %> % if ($next->{station}{platform}) { - <%= l 'auf Gleis' %> <%= $next->{station}{platform} %> + auf Gleis <%= $next->{station}{platform} %> % } % } % elsif ($next->{type} eq 'next' and $next->{station}{arr}) { - %= l 'Nächster Halt:' + Nächster Halt: <%= $next->{station}->loc->name %> - <%= l 'um' %> <%= $next->{station}{arr}->strftime('%H:%M') %> + um <%= $next->{station}{arr}->strftime('%H:%M') %> % if ($next->{station}{arr_delay}) { %= sprintf('(%+d)', $next->{station}{arr_delay}) % } % if ($next->{station}{platform}) { - <%= l 'auf Gleis' %> <%= $next->{station}{platform} %> + auf Gleis <%= $next->{station}{platform} %> % } % } % elsif ($next->{type} eq 'next') { - %= l 'Nächster Halt:' + Nächster Halt: <%= $next->{station}->loc->name %> % if ($next->{station}{platform}) { - <%= l 'auf Gleis' %> <%= $next->{station}{platform} %> + auf Gleis <%= $next->{station}{platform} %> % } % }
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep index 07a705b..24d2d55 100644 --- a/templates/_train_details.html.ep +++ b/templates/_train_details.html.ep @@ -20,27 +20,27 @@
% if ($departure->{is_cancelled} and $departure->{sched_arrival}) { - <%= l 'An:' %> ––:––
<%= l 'Plan:' %> <%= $departure->{sched_arrival} %> + An: ––:––
Plan: <%= $departure->{sched_arrival} %> % } % elsif ($departure->{arrival_is_cancelled}) { - Beginnt hier
<%= l 'Plan:' %> <%= $departure->{sched_arrival} %> + Beginnt hier
Plan: <%= $departure->{sched_arrival} %> % } % elsif ($departure->{arrival}) { % if ($departure->{arrival} ne $departure->{sched_arrival}) { % if (($departure->{delay} // 0) < 0) { - <%= l 'An:' %> <%= $departure->{arrival} %> + An: <%= $departure->{arrival} %> % } % else { - <%= l 'An:' %> <%= $departure->{arrival} %> + An: <%= $departure->{arrival} %> % } -
<%= l 'Plan:' %> <%= $departure->{sched_arrival} %> +
Plan: <%= $departure->{sched_arrival} %> % } % else { - <%= l 'An:' %> <%= $departure->{arrival} %> + An: <%= $departure->{arrival} %> % } % } % elsif ($departure->{sched_arrival}) { - <%= l 'An:' %> <%= $departure->{sched_arrival} %> + An: <%= $departure->{sched_arrival} %> % } % elsif ($departure->{prep_time}) { Ein: <%= $departure->{prep_time} %> @@ -73,10 +73,10 @@ % } % if ($departure->{scheduled_platform} and $departure->{platform} % and $departure->{scheduled_platform} ne $departure->{platform}) { - <%= $left %><%= l 'Gleis' %> <%= $departure->{platform} %><%= $right %> + <%= $left %>Gleis <%= $departure->{platform} %><%= $right %> % } % elsif ($departure->{scheduled_platform} or $departure->{platform}) { - <%= $left %><%= l 'Gleis' %> <%= $departure->{platform} // $departure->{scheduled_platform} %><%= $right %> + <%= $left %>Gleis <%= $departure->{platform} // $departure->{scheduled_platform} %><%= $right %> % } % } % if ($departure->{arrival_hidden} and not $departure->{prep_time}) { @@ -90,22 +90,22 @@
% if ($departure->{is_cancelled} and $departure->{sched_departure}) { - <%= l 'Ab:' %> ––:––
<%= l 'Plan:' %> <%= $departure->{sched_departure} %> + Ab: ––:––
Plan: <%= $departure->{sched_departure} %> % } % elsif ($departure->{departure_is_cancelled}) { - Endet hier
<%= l 'Plan:' %> <%= $departure->{sched_departure} %> + Endet hier
Plan: <%= $departure->{sched_departure} %> % } % elsif ($departure->{departure}) { % if ($departure->{departure} ne $departure->{sched_departure}) { - <%= l 'Ab:' %> <%= $departure->{departure} %> -
<%= l 'Plan:' %> <%= $departure->{sched_departure} %> + Ab: <%= $departure->{departure} %> +
Plan: <%= $departure->{sched_departure} %> % } % else { - <%= l 'Ab:' %> <%= $departure->{departure} %> + Ab: <%= $departure->{departure} %> % } % } % elsif ($departure->{sched_departure}) { - <%= l 'Ab:' %> <%= $departure->{sched_departure} %> + Ab: <%= $departure->{sched_departure} %> % }
@@ -139,10 +139,10 @@
% if ($departure->{trip_id}) { % if (stash('station_name')) { - <%= l 'Karte' %> + Karte % } % else { - <%= l 'Karte' %> + Karte % } % } % if ($departure->{wr_link}) { @@ -161,13 +161,13 @@ % if (my $u = $departure->{utilization}) {
% my ($text, $icon1, $icon2) = utilization_icon($u); - <%= l $text %>. 1. 2. + <%= $text %>. 1. 2.
% } % elsif (my $o = $departure->{occupancy}) {
% my ($text, $icon) = occupancy_icon($o); - <%= l $text %>. + <%= $text %>.
% } % } @@ -184,7 +184,7 @@ % } % if ($departure->{moreinfo} and @{$departure->{moreinfo}}) { -%= l 'Meldungen' + Meldungen
    % for my $pair (@{$departure->{moreinfo}}) {
  • @@ -221,7 +221,7 @@ % } % if ($departure->{route_pre_diff} and $departure->{route_post_diff}) { % if ($departure->{date}) { -%= l 'Fahrtverlauf am' + Fahrtverlauf am % if (stash('train') !~ m{[|]}) { % } @@ -317,7 +317,7 @@
% } % if ($departure->{operator}) { -
<%= l 'Betrieb' %>: <%= $departure->{operator} %>
+
Betrieb: <%= $departure->{operator} %>
% } % if ($departure->{details} and @{$departure->{details}}) {
Details: diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep index 0a977a8..82128ca 100644 --- a/templates/landingpage.html.ep +++ b/templates/landingpage.html.ep @@ -1,6 +1,6 @@ % if (stash 'show_intro') {
-% if (languages() =~ m{^en}) { +% if (0) {

DBF is an unofficial departure monitor for regional and long-distance trains within Germany, aiming to combine multiple data sources in a useful manner. It also has limited support for local transit and traffic outside of Germany. @@ -21,10 +21,10 @@

% }

-%= l 'Oder hier angeben:' +Oder hier angeben:

% } diff --git a/templates/layouts/app.html.ep b/templates/layouts/app.html.ep index ab4dffa..94e0930 100644 --- a/templates/layouts/app.html.ep +++ b/templates/layouts/app.html.ep @@ -102,8 +102,8 @@
% } % elsif (stash('stationlist')) { -
<%= l 'Mehrdeutige Eingabe' %>. -<%= l 'Bitte eine Station aus der Liste auswählen' %>
+
Mehrdeutige Eingabe. +Bitte eine Station aus der Liste auswählen
% }
@@ -119,35 +119,35 @@ %= form_for _redirect => begin
-
<%= l 'Zug / Station' %>
+
Zug / Station
% if (stash('stationlist')) { %= select_field input => stash('stationlist') % } % elsif (stash('input')) { - %= text_field 'input', class => 'station', placeholder => l 'Zug, Stationsname oder Ril100-Kürzel', id => 'stationinput' + %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder Ril100-Kürzel', id => 'stationinput' % } % else { - %= text_field 'input', class => 'station', placeholder => l 'Zug, Stationsname oder Ril100-Kürzel', id => 'stationinput', autofocus => 'autofocus' + %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder Ril100-Kürzel', id => 'stationinput', autofocus => 'autofocus' % }
- %= submit_button l('Abfahrtstafel') + %= submit_button 'Abfahrtstafel'
% if (stash('input')) { % }
-
<%= l 'Weitere Einstellungen' %>
+
Weitere Einstellungen
%= check_box 'rt' => 1, id => 'id_show_realtime'
@@ -155,7 +155,7 @@
%= check_box 'hidelowdelay' => 1, id => 'id_hidelowdelay'
@@ -163,7 +163,7 @@
%= check_box 'detailed' => 1, id => 'id_detailed'
@@ -171,7 +171,7 @@
%= check_box 'no_related' => 1, id => 'id_no_related'
@@ -179,7 +179,7 @@
%= check_box 'past' => 1, id => 'past'
@@ -187,21 +187,21 @@
%= check_box 'hide_opts' => 1, id => 'id_hide_opts'
- %= l 'Nur Züge über' + Nur Züge über
- %= text_field 'via', placeholder => l('Bahnhof 1, Bhf2, ... (oder regulärer Ausdruck)'), class => 'station' + %= text_field 'via', placeholder => 'Bahnhof 1, Bhf2, ... (oder regulärer Ausdruck)', class => 'station'
- %= l 'Gleise' + Gleise
%= text_field 'platforms', placeholder => '1, 2, 5, ...' @@ -209,10 +209,10 @@
- %= l 'Ankunfts- oder Abfahrtszeit anzeigen?' + Ankunfts- oder Abfahrtszeit anzeigen?
- %= select_field admode => [[l('Abfahrt bevorzugen') => 'deparr'], [l('Nur Abfahrt') => 'dep'], [l('Nur Ankunft') => 'arr']] + %= select_field admode => [['Abfahrt bevorzugen' => 'deparr'], ['Nur Abfahrt' => 'dep'], ['Nur Ankunft' => 'arr']]
@@ -224,7 +224,7 @@
- %= submit_button l('Anzeigen') + %= submit_button 'Anzeigen'
@@ -236,7 +236,7 @@
API