Skip to content

Commit be5ace0

Browse files
authored
chore: add missing translations (#982)
Fix translation issues from Hebrew to English
1 parent f924722 commit be5ace0

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/App.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import './App.scss'
22
import 'leaflet/dist/leaflet.css'
33
import 'moment/locale/he'
4+
import { useTranslation } from 'react-i18next'
45
import { RouterProvider } from 'react-router-dom'
5-
import { Suspense } from 'react'
6+
import { Suspense, useEffect } from 'react'
67
import moment from 'moment-timezone'
78
import Preloader from './shared/Preloader'
89
import router from './routes'
@@ -18,9 +19,20 @@ if ('serviceWorker' in navigator) {
1819
.catch((err) => console.error('Service Worker Registration Failed', err))
1920
}
2021

21-
export const RoutedApp = () => (
22-
<Suspense fallback={<Preloader />}>
23-
<RouterProvider router={router} />
24-
</Suspense>
25-
)
22+
export const RoutedApp = () => {
23+
const { i18n } = useTranslation() // Access i18n for language management
24+
const currentLanguage = i18n.language // Get the current language
25+
26+
// Effect hook to update the title based on the current language
27+
useEffect(() => {
28+
const title = currentLanguage === 'he' ? 'דאטאבוס' : 'Databus' // Set title based on language
29+
document.title = title // Update the <title> tag in the document
30+
}, [currentLanguage]) // Re-run when the language changes
31+
32+
return (
33+
<Suspense fallback={<Preloader />}>
34+
<RouterProvider router={router} />
35+
</Suspense>
36+
)
37+
}
2638
export default RoutedApp

src/locale/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
"youtube_modal_info_title": "Video tutorial (Hebrew)",
233233
"open_video_about_this_page": "Open video about this page",
234234
"publicAppealPage": {
235-
"title": "קול קורא",
235+
"title": "Public Appeal",
236236
"tasks": [
237237
{
238238
"title": "What affect does the traffic have on the overall execusion time of bus ride?",

src/pages/timeBasedMap/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { INPUT_SIZE } from 'src/resources/sizes'
2424
import { VehicleLocation } from 'src/model/vehicleLocation'
2525
import useVehicleLocations from 'src/api/useVehicleLocations'
2626
import getAgencyList, { Agency } from 'src/api/agencyList'
27+
import i18n from 'src/locale/allTranslations'
2728

2829
export interface Point {
2930
loc: [number, number]
@@ -158,8 +159,8 @@ export default function TimeBasedMapPage() {
158159
{loaded} {`- `}
159160
{t('show_x_bus_locations')} {` `}
160161
{t('from_time_x_to_time_y')
161-
.replace('XXX', moment(from).format('hh:mm A'))
162-
.replace('YYY', moment(to).format('hh:mm A'))}
162+
.replace('XXX', moment(from).locale(i18n.language).format('hh:mm A'))
163+
.replace('YYY', moment(to).locale(i18n.language).format('hh:mm A'))}
163164
</p>
164165
</Grid>
165166
<Grid xs={1}>{isLoading && <CircularProgress size="20px" />}</Grid>

0 commit comments

Comments
 (0)