Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/dotcom_web/components/new_timetable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@ defmodule DotcomWeb.Components.NewTimetable do
defp format!(nil), do: ""
defp format!(time), do: Dotcom.Utils.Time.format!(time, :hour_12_minutes)

defp vehicle_name(route), do: Routes.Route.vehicle_name(route) <> "s"
defp vehicle_name(route), do: Routes.Route.vehicle_name(route, plural: true)
end
26 changes: 12 additions & 14 deletions lib/dotcom_web/components/timetable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,21 @@ defmodule DotcomWeb.Components.Timetable do
<% # only show scroll controllers if we have 2 or more schedules %>
<%= if @trip_count >= 2 do %>
<span class="m-timetable__trains-label">
{Routes.Route.vehicle_name(@route) <> "s"}
{vehicle_name(@route)}
</span>
<button
class="m-timetable__scroll-btn m-timetable__scroll-btn--left btn btn-outline-primary btn-sm"
data-scroll="earlier"
>
{fa("angle-left m-timetable__scroll-btn-arrow")} {~t(Earlier)} {Routes.Route.vehicle_name(
@route
) <> "s"}
{fa("angle-left m-timetable__scroll-btn-arrow")}
{gettext("Earlier %{vehicle_name}", vehicle_name: vehicle_name(@route))}
</button>
<button
class="m-timetable__scroll-btn m-timetable__scroll-btn--right btn btn-outline-primary btn-sm"
data-scroll="later"
>
{~t(Later)} {Routes.Route.vehicle_name(@route) <> "s"} {fa(
"angle-right m-timetable__scroll-btn-arrow"
)}
{gettext("Later %{vehicle_name}", vehicle_name: vehicle_name(@route))}
{fa("angle-right m-timetable__scroll-btn-arrow")}
</button>
<% end %>
</div>
Expand Down Expand Up @@ -167,23 +165,21 @@ defmodule DotcomWeb.Components.Timetable do
<% # only show scroll controllers if we have 2 or more schedules %>
<%= if @trip_count >= 2 do %>
<span class="m-timetable__trains-label">
{Routes.Route.vehicle_name(@route) <> "s"}
{vehicle_name(@route)}
</span>
<button
class="m-timetable__scroll-btn m-timetable__scroll-btn--left btn btn-outline-primary btn-sm"
data-scroll="earlier"
>
{fa("angle-left m-timetable__scroll-btn-arrow")} {~t(Earlier)} {Routes.Route.vehicle_name(
@route
) <> "s"}
{fa("angle-left m-timetable__scroll-btn-arrow")}
{gettext("Earlier %{vehicle_name}", vehicle_name: vehicle_name(@route))}
</button>
<button
class="m-timetable__scroll-btn m-timetable__scroll-btn--right btn btn-outline-primary btn-sm"
data-scroll="later"
>
{~t(Later)} {Routes.Route.vehicle_name(@route) <> "s"} {fa(
"angle-right m-timetable__scroll-btn-arrow"
)}
{gettext("Later %{vehicle_name}", vehicle_name: vehicle_name(@route))}
{fa("angle-right m-timetable__scroll-btn-arrow")}
</button>
<% end %>
</div>
Expand Down Expand Up @@ -362,4 +358,6 @@ defmodule DotcomWeb.Components.Timetable do

defp format!(nil), do: ""
defp format!(time), do: Dotcom.Utils.Time.format!(time, :hour_12_minutes)

defp vehicle_name(route), do: Routes.Route.vehicle_name(route, plural: true)
end
19 changes: 10 additions & 9 deletions lib/routes/route.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
defmodule Routes.Route do
@moduledoc "Data model and helpers corresponding to the V3 API Route resource."

use Dotcom.Gettext.Sigils

@routes_repo Application.compile_env!(:dotcom, :repo_modules)[:routes]

@derive Jason.Encoder
Expand Down Expand Up @@ -215,18 +217,17 @@ defmodule Routes.Route do
Map.get(destinations, direction_id)
end

@spec vehicle_name(t, Keyword.t()) :: String.t()
@spec vehicle_name(t) :: String.t()
def vehicle_name(%__MODULE__{type: type}) when type in [0, 1, 2] do
"Train"
end
def vehicle_name(%__MODULE__{type: type}, plural: true) when type in [0, 1, 2], do: ~t"Trains"
def vehicle_name(%__MODULE__{type: 3}, plural: true), do: ~t"Buses"
def vehicle_name(%__MODULE__{type: 4}, plural: true), do: ~t"Boats"

def vehicle_name(%__MODULE__{type: 3}) do
"Bus"
end
def vehicle_name(%__MODULE__{} = route, _opts), do: vehicle_name(route)

def vehicle_name(%__MODULE__{type: 4}) do
"Boat"
end
def vehicle_name(%__MODULE__{type: type}) when type in [0, 1, 2], do: ~t"Train"
def vehicle_name(%__MODULE__{type: 3}), do: ~t"Bus"
def vehicle_name(%__MODULE__{type: 4}), do: ~t"Boat"

@spec vehicle_atom(0..4) :: atom
def vehicle_atom(0), do: :trolley
Expand Down
30 changes: 24 additions & 6 deletions priv/gettext/dotcom.pot
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ msgstr ""
#: lib/dotcom_web/controllers/schedule/route_breadcrumbs.ex
#: lib/dotcom_web/views/helpers.ex
#: lib/dotcom_web/views/layout_view.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Bus"
msgstr ""
Expand Down Expand Up @@ -1262,11 +1263,6 @@ msgstr ""
msgid "EZ Pass"
msgstr ""

#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier"
msgstr ""

#: lib/dotcom_web/components/trip_planner/helpers.ex
#, elixir-autogen, elixir-format
msgid "Earliest Arrival"
Expand Down Expand Up @@ -2084,7 +2080,6 @@ msgid "Last %{vehicle}"
msgstr ""

#: lib/dotcom/utils/service_date_time.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later"
msgstr ""
Expand Down Expand Up @@ -4413,6 +4408,7 @@ msgid "Track your %{route_type_text} trip live with the <strong>MBTA Go</strong>
msgstr ""

#: lib/dotcom_web/live/schedule_finder_live.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Train"
msgstr ""
Expand Down Expand Up @@ -5380,11 +5376,33 @@ msgid "Weekend schedules"
msgstr ""

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier %{vehicle_name}"
msgstr ""

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later %{vehicle_name}"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boat"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boats"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Buses"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Trains"
msgstr ""
30 changes: 24 additions & 6 deletions priv/gettext/en/LC_MESSAGES/dotcom.po
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ msgstr ""
#: lib/dotcom_web/controllers/schedule/route_breadcrumbs.ex
#: lib/dotcom_web/views/helpers.ex
#: lib/dotcom_web/views/layout_view.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Bus"
msgstr ""
Expand Down Expand Up @@ -1262,11 +1263,6 @@ msgstr ""
msgid "EZ Pass"
msgstr ""

#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier"
msgstr ""

#: lib/dotcom_web/components/trip_planner/helpers.ex
#, elixir-autogen, elixir-format
msgid "Earliest Arrival"
Expand Down Expand Up @@ -2084,7 +2080,6 @@ msgid "Last %{vehicle}"
msgstr ""

#: lib/dotcom/utils/service_date_time.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later"
msgstr ""
Expand Down Expand Up @@ -4413,6 +4408,7 @@ msgid "Track your %{route_type_text} trip live with the <strong>MBTA Go</strong>
msgstr ""

#: lib/dotcom_web/live/schedule_finder_live.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Train"
msgstr ""
Expand Down Expand Up @@ -5380,11 +5376,33 @@ msgid "Weekend schedules"
msgstr ""

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier %{vehicle_name}"
msgstr ""

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later %{vehicle_name}"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boat"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boats"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Buses"
msgstr ""

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Trains"
msgstr ""
30 changes: 24 additions & 6 deletions priv/gettext/es/LC_MESSAGES/dotcom.po
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ msgstr "Llevar tu auto o bicicleta"
#: lib/dotcom_web/controllers/schedule/route_breadcrumbs.ex
#: lib/dotcom_web/views/helpers.ex
#: lib/dotcom_web/views/layout_view.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Bus"
msgstr "autobús"
Expand Down Expand Up @@ -1265,11 +1266,6 @@ msgstr "Tarjeta EBT"
msgid "EZ Pass"
msgstr "EZ pase"

#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier"
msgstr "Antes"

#: lib/dotcom_web/components/trip_planner/helpers.ex
#, elixir-autogen, elixir-format
msgid "Earliest Arrival"
Expand Down Expand Up @@ -2089,7 +2085,6 @@ msgid "Last %{vehicle}"
msgstr "Último %{vehicle}"

#: lib/dotcom/utils/service_date_time.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later"
msgstr "Más tarde"
Expand Down Expand Up @@ -4431,6 +4426,7 @@ msgid "Track your %{route_type_text} trip live with the <strong>MBTA Go</strong>
msgstr "Sigue tu viaje de %{route_type_text} en directo con la app <strong>MBTA Go</strong>"

#: lib/dotcom_web/live/schedule_finder_live.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Train"
msgstr "Tren"
Expand Down Expand Up @@ -5403,11 +5399,33 @@ msgid "Weekend schedules"
msgstr "Fin de semana horario"

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier %{vehicle_name}"
msgstr "Antes %{vehicle_name}"

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later %{vehicle_name}"
msgstr "Más tarde %{vehicle_name}"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boat"
msgstr "Barco"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boats"
msgstr "Barcos"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Buses"
msgstr "Autobuses"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Trains"
msgstr "Trenes"
30 changes: 24 additions & 6 deletions priv/gettext/fr-FR/LC_MESSAGES/dotcom.po
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ msgstr "Emmener votre voiture ou votre vélo"
#: lib/dotcom_web/controllers/schedule/route_breadcrumbs.ex
#: lib/dotcom_web/views/helpers.ex
#: lib/dotcom_web/views/layout_view.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Bus"
msgstr "bus"
Expand Down Expand Up @@ -1265,11 +1266,6 @@ msgstr "Carte EBT"
msgid "EZ Pass"
msgstr "EZ titre de transport"

#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier"
msgstr "Plus tôt"

#: lib/dotcom_web/components/trip_planner/helpers.ex
#, elixir-autogen, elixir-format
msgid "Earliest Arrival"
Expand Down Expand Up @@ -2089,7 +2085,6 @@ msgid "Last %{vehicle}"
msgstr "Dernier %{vehicle}"

#: lib/dotcom/utils/service_date_time.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later"
msgstr "Plus tard"
Expand Down Expand Up @@ -4433,6 +4428,7 @@ msgid "Track your %{route_type_text} trip live with the <strong>MBTA Go</strong>
msgstr "Suivez votre %{route_type_text} voyage en direct avec l’application <strong>MBTA Go</strong>"

#: lib/dotcom_web/live/schedule_finder_live.ex
#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Train"
msgstr "Train"
Expand Down Expand Up @@ -5404,11 +5400,33 @@ msgid "Weekend schedules"
msgstr "Horaire week-end"

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Earlier %{vehicle_name}"
msgstr "Plus tôt %{vehicle_name}"

#: lib/dotcom_web/components/new_timetable.ex
#: lib/dotcom_web/components/timetable.ex
#, elixir-autogen, elixir-format
msgid "Later %{vehicle_name}"
msgstr "Plus tard %{vehicle_name}"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boat"
msgstr "Bateau"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Boats"
msgstr "Bateaux"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Buses"
msgstr "Bus"

#: lib/routes/route.ex
#, elixir-autogen, elixir-format
msgid "Trains"
msgstr "Trains"
Loading
Loading