From 3dac17a9fb54c977c97280ed4c482e9d4266b7de Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Tue, 24 Jun 2025 16:58:30 +0200 Subject: Add missing translations --- src/frontend/app/components/NavBar.tsx | 8 +++++--- src/frontend/app/components/RegularTable.tsx | 20 +++++++++++--------- src/frontend/app/i18n/locales/en-GB.json | 22 +++++++++++++++++++--- src/frontend/app/i18n/locales/es-ES.json | 22 +++++++++++++++++++--- src/frontend/app/i18n/locales/gl-ES.json | 22 +++++++++++++++++++--- src/frontend/app/routes/estimates-$id.tsx | 2 +- src/frontend/app/routes/stoplist.tsx | 14 +++++++------- 7 files changed, 81 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/frontend/app/components/NavBar.tsx b/src/frontend/app/components/NavBar.tsx index 091cc21..eba7196 100644 --- a/src/frontend/app/components/NavBar.tsx +++ b/src/frontend/app/components/NavBar.tsx @@ -2,6 +2,7 @@ import { Link } from "react-router"; import { Map, MapPin, Settings } from "lucide-react"; import { useApp } from "../AppContext"; import type { LngLatLike } from "maplibre-gl"; +import { useTranslation } from "react-i18next"; // Helper: check if coordinates are within Vigo bounds function isWithinVigo(lngLat: LngLatLike): boolean { @@ -19,16 +20,17 @@ function isWithinVigo(lngLat: LngLatLike): boolean { } export default function NavBar() { + const { t } = useTranslation(); const { mapState, updateMapState, mapPositionMode } = useApp(); const navItems = [ { - name: 'Paradas', + name: t('navbar.stops', 'Paradas'), icon: MapPin, path: '/stops' }, { - name: 'Mapa', + name: t('navbar.map', 'Mapa'), icon: Map, path: '/map', callback: () => { @@ -53,7 +55,7 @@ export default function NavBar() { } }, { - name: 'Ajustes', + name: t('navbar.settings', 'Ajustes'), icon: Settings, path: '/settings' } diff --git a/src/frontend/app/components/RegularTable.tsx b/src/frontend/app/components/RegularTable.tsx index 75b598b..e5b3782 100644 --- a/src/frontend/app/components/RegularTable.tsx +++ b/src/frontend/app/components/RegularTable.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from "react-i18next"; import { type StopDetails } from "../routes/estimates-$id"; import LineIcon from "./LineIcon"; @@ -7,6 +8,7 @@ interface RegularTableProps { } export const RegularTable: React.FC = ({ data, dataDate }) => { + const { t } = useTranslation(); const absoluteArrivalTime = (minutes: number) => { const now = new Date() @@ -21,19 +23,19 @@ export const RegularTable: React.FC = ({ data, dataDate }) => if (meters > 1024) { return `${(meters / 1000).toFixed(1)} km`; } else { - return `${meters} m`; + return `${meters} ${t('estimates.meters', 'm')}`; } } return - + - - - - + + + + @@ -47,12 +49,12 @@ export const RegularTable: React.FC = ({ data, dataDate }) => @@ -62,7 +64,7 @@ export const RegularTable: React.FC = ({ data, dataDate }) => {data?.estimates.length === 0 && ( - + )} diff --git a/src/frontend/app/i18n/locales/en-GB.json b/src/frontend/app/i18n/locales/en-GB.json index f53a802..cd0780c 100644 --- a/src/frontend/app/i18n/locales/en-GB.json +++ b/src/frontend/app/i18n/locales/en-GB.json @@ -24,15 +24,26 @@ }, "stoplist": { "search_placeholder": "Search stop...", - "favourites": "Favourites", - "recents": "Recent" + "search_label": "Search stops", + "search_results": "Search results", + "favourites": "Favourite stops", + "no_favourites": "Go to a stop and mark it as favourite to see it here.", + "recents": "Recent", + "all_stops": "Stops" }, "estimates": { "minutes": "min", "meters": "m", "edit": "Edit name", "favourite": "Favourite", - "not_found": "Stop not found" + "not_found": "Stop not found", + "caption": "Arrival estimates at {{time}}", + "line": "Line", + "route": "Route", + "arrival": "Arrival", + "distance": "Distance", + "not_available": "Not available", + "none": "No estimates available" }, "map": { "popup_title": "Stop", @@ -42,5 +53,10 @@ "loading": "Loading...", "error": "An unexpected error occurred.", "404": "The requested page could not be found." + }, + "navbar": { + "stops": "Stops", + "map": "Map", + "settings": "Settings" } } diff --git a/src/frontend/app/i18n/locales/es-ES.json b/src/frontend/app/i18n/locales/es-ES.json index 814019e..2f2bb86 100644 --- a/src/frontend/app/i18n/locales/es-ES.json +++ b/src/frontend/app/i18n/locales/es-ES.json @@ -24,15 +24,26 @@ }, "stoplist": { "search_placeholder": "Buscar parada...", - "favourites": "Favoritas", - "recents": "Recientes" + "search_label": "Buscar paradas", + "search_results": "Resultados de la búsqueda", + "favourites": "Paradas favoritas", + "no_favourites": "Accede a una parada y márcala como favorita para verla aquí.", + "recents": "Recientes", + "all_stops": "Paradas" }, "estimates": { "minutes": "min", "meters": "m", "edit": "Editar nombre", "favourite": "Favorito", - "not_found": "No se encontró la parada" + "not_found": "No se encontró la parada", + "caption": "Estimaciones de llegadas a las {{time}}", + "line": "Línea", + "route": "Ruta", + "arrival": "Llegada", + "distance": "Distancia", + "not_available": "No disponible", + "none": "No hay estimaciones disponibles" }, "map": { "popup_title": "Parada", @@ -42,5 +53,10 @@ "loading": "Cargando...", "error": "Ha ocurrido un error inesperado.", "404": "La página solicitada no se pudo encontrar." + }, + "navbar": { + "stops": "Paradas", + "map": "Mapa", + "settings": "Ajustes" } } diff --git a/src/frontend/app/i18n/locales/gl-ES.json b/src/frontend/app/i18n/locales/gl-ES.json index 3c0c2fc..d2558e5 100644 --- a/src/frontend/app/i18n/locales/gl-ES.json +++ b/src/frontend/app/i18n/locales/gl-ES.json @@ -24,15 +24,26 @@ }, "stoplist": { "search_placeholder": "Buscar parada...", - "favourites": "Favoritas", - "recents": "Recentes" + "search_label": "Buscar paradas", + "search_results": "Resultados da busca", + "favourites": "Paradas favoritas", + "no_favourites": "Accede a unha parada e márcaa como favorita para vela aquí.", + "recents": "Recentes", + "all_stops": "Paradas" }, "estimates": { "minutes": "min", "meters": "m", "edit": "Editar nome", "favourite": "Favorita", - "not_found": "Non se atopou a parada" + "not_found": "Non se atopou a parada", + "caption": "Estimacións de chegadas ás {{time}}", + "line": "Liña", + "route": "Ruta", + "arrival": "Chegada", + "distance": "Distancia", + "not_available": "Non dispoñible", + "none": "Non hai estimacións dispoñibles" }, "map": { "popup_title": "Parada", @@ -42,5 +53,10 @@ "loading": "Cargando...", "error": "Produciuse un erro inesperado.", "404": "Non se puido atopar a páxina solicitada." + }, + "navbar": { + "stops": "Paradas", + "map": "Mapa", + "settings": "Axustes" } } diff --git a/src/frontend/app/routes/estimates-$id.tsx b/src/frontend/app/routes/estimates-$id.tsx index 5dbbc7d..e0e4fff 100644 --- a/src/frontend/app/routes/estimates-$id.tsx +++ b/src/frontend/app/routes/estimates-$id.tsx @@ -83,7 +83,7 @@ export default function Estimates() { } }; - if (data === null) return

Cargando datos en tiempo real...

+ if (data === null) return

{t('common.loading')}

return (
diff --git a/src/frontend/app/routes/stoplist.tsx b/src/frontend/app/routes/stoplist.tsx index 0ab6d15..9404b39 100644 --- a/src/frontend/app/routes/stoplist.tsx +++ b/src/frontend/app/routes/stoplist.tsx @@ -58,7 +58,7 @@ export default function StopList() { return stopsList.reverse(); }, [data]); - if (data === null) return

Loading...

+ if (data === null) return

{t('common.loading')}

return (
@@ -67,7 +67,7 @@ export default function StopList() {
@@ -75,7 +75,7 @@ export default function StopList() { {searchResults && searchResults.length > 0 && (
-

Resultados de la búsqueda

+

{t('stoplist.search_results', 'Resultados de la búsqueda')}

    {searchResults.map((stop: Stop) => ( @@ -85,11 +85,11 @@ export default function StopList() { )}
    -

    Paradas favoritas

    +

    {t('stoplist.favourites')}

    {favouritedStops?.length === 0 && (

    - Accede a una parada y márcala como favorita para verla aquí. + {t('stoplist.no_favourites', 'Accede a una parada y márcala como favorita para verla aquí.')}

    )} @@ -102,7 +102,7 @@ export default function StopList() { {recentStops && recentStops.length > 0 && (
    -

    Recientes

    +

    {t('stoplist.recents')}

      {recentStops.map((stop: Stop) => ( @@ -113,7 +113,7 @@ export default function StopList() { )}
      -

      Paradas

      +

      {t('stoplist.all_stops', 'Paradas')}

        {data?.sort((a, b) => a.stopId - b.stopId).map((stop: Stop) => ( -- cgit v1.3
Estimaciones de llegadas a las {dataDate?.toLocaleTimeString()}{t('estimates.caption', 'Estimaciones de llegadas a las {{time}}', { time: dataDate?.toLocaleTimeString() })}
LíneaRutaLlegadaDistancia{t('estimates.line', 'Línea')}{t('estimates.route', 'Ruta')}{t('estimates.arrival', 'Llegada')}{t('estimates.distance', 'Distancia')}
{estimate.minutes > 15 ? absoluteArrivalTime(estimate.minutes) - : `${estimate.minutes} min`} + : `${estimate.minutes} ${t('estimates.minutes', 'min')}`} {estimate.meters > -1 ? formatDistance(estimate.meters) - : "No disponible" + : t('estimates.not_available', 'No disponible') }
No hay estimaciones disponibles{t('estimates.none', 'No hay estimaciones disponibles')}