Skip to content

Commit

Permalink
chore: add missing translations (#982)
Browse files Browse the repository at this point in the history
Fix translation issues from Hebrew to English
  • Loading branch information
EstherKal authored Dec 19, 2024
1 parent f924722 commit be5ace0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
24 changes: 18 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import './App.scss'
import 'leaflet/dist/leaflet.css'
import 'moment/locale/he'
import { useTranslation } from 'react-i18next'
import { RouterProvider } from 'react-router-dom'
import { Suspense } from 'react'
import { Suspense, useEffect } from 'react'
import moment from 'moment-timezone'
import Preloader from './shared/Preloader'
import router from './routes'
Expand All @@ -18,9 +19,20 @@ if ('serviceWorker' in navigator) {
.catch((err) => console.error('Service Worker Registration Failed', err))
}

export const RoutedApp = () => (
<Suspense fallback={<Preloader />}>
<RouterProvider router={router} />
</Suspense>
)
export const RoutedApp = () => {
const { i18n } = useTranslation() // Access i18n for language management
const currentLanguage = i18n.language // Get the current language

// Effect hook to update the title based on the current language
useEffect(() => {
const title = currentLanguage === 'he' ? 'דאטאבוס' : 'Databus' // Set title based on language
document.title = title // Update the <title> tag in the document
}, [currentLanguage]) // Re-run when the language changes

return (
<Suspense fallback={<Preloader />}>
<RouterProvider router={router} />
</Suspense>
)
}
export default RoutedApp
2 changes: 1 addition & 1 deletion src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"youtube_modal_info_title": "Video tutorial (Hebrew)",
"open_video_about_this_page": "Open video about this page",
"publicAppealPage": {
"title": "קול קורא",
"title": "Public Appeal",
"tasks": [
{
"title": "What affect does the traffic have on the overall execusion time of bus ride?",
Expand Down
5 changes: 3 additions & 2 deletions src/pages/timeBasedMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { INPUT_SIZE } from 'src/resources/sizes'
import { VehicleLocation } from 'src/model/vehicleLocation'
import useVehicleLocations from 'src/api/useVehicleLocations'
import getAgencyList, { Agency } from 'src/api/agencyList'
import i18n from 'src/locale/allTranslations'

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

0 comments on commit be5ace0

Please sign in to comment.