Skip to content

Commit

Permalink
fix: add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
bastyen committed Sep 18, 2024
1 parent fc13c8c commit 0c8e28e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
11 changes: 8 additions & 3 deletions src/components/grw-map/grw-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,7 @@ export class GrwMap {
}

componentDidLoad() {
this.map = L.map(this.mapRef, { zoom: 4, center: [47, 2] });

L.control.scale({ metric: true, imperial: false }).addTo(this.map);
this.map = L.map(this.mapRef, { zoom: 4, center: [47, 2], zoomControl: false });

const nameLayers = this.nameLayer ? this.nameLayer.split(',') : [];

Expand Down Expand Up @@ -305,6 +303,10 @@ export class GrwMap {
.addTo(this.map);
}

L.control.zoom({ zoomInTitle: translate[state.language].zoomIn, zoomOutTitle: translate[state.language].zoomOut }).addTo(this.map);

L.control.scale({ metric: true, imperial: false }).addTo(this.map);

(L.Control as any).Contract = L.Control.extend({
onAdd: () => {
const contractContainer = L.DomUtil.create('div');
Expand All @@ -316,6 +318,8 @@ export class GrwMap {
this.bounds && this.map.fitBounds(this.bounds);
e.preventDefault();
};
contract.title = translate[state.language].contract;

return contractContainer;
},
});
Expand All @@ -329,6 +333,7 @@ export class GrwMap {
new (L.Control as any).SimpleLocate({
position: 'topleft',
className: 'button-locate',
title: translate[state.language].locate,
}).addTo(this.map);

if (state.currentTrek) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ grw-outdoor-course-detail {
line-height: 28px;
font-weight: 400;
font-weight: bold;
overflow-wrap: break-word;
}
.description-title,
.advice-title,
Expand Down
26 changes: 21 additions & 5 deletions src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ interface Translation {
onlyOfflineTreks: string;
onlyOfflineOutdoor: string;
moreDetails: string;
zoomIn: string;
zoomOut: string;
contract: string;
locate: string;
}

interface AvailableTranslations {
Expand Down Expand Up @@ -254,6 +258,10 @@ const defaultTranslate: AvailableTranslations = {
onlyOfflineTreks: 'Afficher uniquement les itinéraires hors ligne',
onlyOfflineOutdoor: 'Afficher uniquement les outdoor hors ligne',
moreDetails: 'Plus de détails',
zoomIn: 'Zoomer',
zoomOut: 'Dézoomer',
contract: 'Réinitialiser la position de la carte',
locate: 'Géolocaliser',
},
en: {
filter: 'Filter',
Expand Down Expand Up @@ -329,7 +337,7 @@ const defaultTranslate: AvailableTranslations = {
steps: 'Steps',
touristicContents: 'Near',
touristicEvents: 'Events',
sites: 'sites',
sites: 'Sites',
courses: 'Courses',
signages: 'Signages',
},
Expand All @@ -356,7 +364,7 @@ const defaultTranslate: AvailableTranslations = {
readMore: 'Read more',
readLess: 'Read less',
sensitiveAreasDescription:
"Along your trek, you will go through sensitive areas related to the presence of a specific species or environment. In these areas, an appropriate behaviour allows to contribute to their preservation. For detailed information, specific forms are accessible for each area.",
'Along your trek, you will go through sensitive areas related to the presence of a specific species or environment. In these areas, an appropriate behaviour allows to contribute to their preservation. For detailed information, specific forms are accessible for each area.',
emergencyNumber: 'Emergency number',
learnMore: 'Learn more',
date: 'Date',
Expand All @@ -379,6 +387,10 @@ const defaultTranslate: AvailableTranslations = {
onlyOfflineTreks: 'Only display offline treks',
onlyOfflineOutdoor: 'Only display offline outdoor',
moreDetails: 'More details',
zoomIn: 'Zoom in',
zoomOut: 'Zoom out',
contract: 'Reset map position',
locate: 'Geolocate',
},
es: {
filter: 'Filtrar',
Expand Down Expand Up @@ -424,7 +436,7 @@ const defaultTranslate: AvailableTranslations = {
treks: 'Itinerarios',
touristicContents: 'Servicios',
touristicEvents: 'Eventos',
outdoorSites: 'Outdoor'
outdoorSites: 'Outdoor',
},
touristicContents: 'Servicios',
touristicContent: 'Servicio',
Expand Down Expand Up @@ -454,7 +466,7 @@ const defaultTranslate: AvailableTranslations = {
steps: 'Etapas',
touristicContents: 'En las cercanías',
touristicEvents: 'Eventos',
sites: 'sitios',
sites: 'Sitios',
courses: 'Recorrido',
signages: 'Señalizaciones',
},
Expand All @@ -481,7 +493,7 @@ const defaultTranslate: AvailableTranslations = {
readMore: 'Leer más',
readLess: 'Leer menos',
sensitiveAreasDescription:
"A lo largo de su ruta, pasará por zonas sensibles vinculadas a la presencia de una especie o un entorno determinados.En estas zonas, un comportamiento adecuado puede contribuir a preservarlas.Para obtener informaciónes más detalladas, fichas específicas para cada zona estan disponibles.",
'A lo largo de su ruta, pasará por zonas sensibles vinculadas a la presencia de una especie o un entorno determinados.En estas zonas, un comportamiento adecuado puede contribuir a preservarlas.Para obtener informaciónes más detalladas, fichas específicas para cada zona estan disponibles.',
emergencyNumber: 'Número de emergencia',
learnMore: 'Más información',
date: 'Fecha',
Expand All @@ -504,6 +516,10 @@ const defaultTranslate: AvailableTranslations = {
onlyOfflineTreks: 'Mostrar sólo itinerarios en modo sin conexión',
onlyOfflineOutdoor: 'Mostrar sólo los outdoor disponible sin conexión',
moreDetails: 'Más detalles',
zoomIn: 'Zoom',
zoomOut: 'Zoom',
contract: 'Restablecer la posición del mapa',
locate: 'Geolocalizar',
},
};

Expand Down

0 comments on commit 0c8e28e

Please sign in to comment.