From 3c8737ee79867d0ecf832106c220a00fa3de6f92 Mon Sep 17 00:00:00 2001 From: balog-b Date: Tue, 13 Feb 2024 21:47:31 +0100 Subject: [PATCH] Translated additional text post rebase --- app/(tabs)/map.tsx | 6 +- .../presentation/favorite-presentations.tsx | 6 +- app/(tabs)/presentation/index.tsx | 2 +- app/[...unmatched].tsx | 8 +- components/common/error-boundary.tsx | 8 +- content/map-resources-en.content.ts | 174 ++++++++++++++++++ ...content.ts => map-resources-hu.content.ts} | 2 +- services/i18n_data.ts | 34 +++- 8 files changed, 226 insertions(+), 14 deletions(-) create mode 100644 content/map-resources-en.content.ts rename content/{map-resources.content.ts => map-resources-hu.content.ts} (98%) diff --git a/app/(tabs)/map.tsx b/app/(tabs)/map.tsx index 53ed750..02345c4 100644 --- a/app/(tabs)/map.tsx +++ b/app/(tabs)/map.tsx @@ -7,7 +7,8 @@ import { Header } from '../../components/common/header'; import { Title } from '../../components/common/title'; import { Map } from '../../components/map/map'; import { ResourceSheet } from '../../components/map/resource-sheet'; -import { MapResources } from '../../content/map-resources.content'; +import { MapResources_en } from '../../content/map-resources-en.content'; +import { MapResources_hu } from '../../content/map-resources-hu.content'; import { MapResource } from '../../types/map.type'; export default function MapPage() { @@ -15,7 +16,8 @@ export default function MapPage() { const [selectedResource, setSelectedResource] = useState(); const onSelectedResource = (id: string) => { - const res = MapResources.find((r) => r.id === id); + const localizedResource = t('map.key') === 'hu' ? MapResources_hu : MapResources_en; + const res = localizedResource.find((r) => r.id === id); setSelectedResource(res); }; diff --git a/app/(tabs)/presentation/favorite-presentations.tsx b/app/(tabs)/presentation/favorite-presentations.tsx index 52e6555..5fe1db5 100644 --- a/app/(tabs)/presentation/favorite-presentations.tsx +++ b/app/(tabs)/presentation/favorite-presentations.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { useTranslation } from 'react-i18next'; import { Screen } from '../../../components/base/screen'; import { ErrorMessage } from '../../../components/common/error-message'; @@ -10,14 +11,15 @@ import { useFavoritePresentationsList } from '../../../hooks/use-favorite-presen export default function FavoritePresentationsScreen() { const { data, isLoading, isError } = useFavoritePresentationsList(); + const { t } = useTranslation(); return (
- Kedvenc előadásaim + {t('presentations.favoritesTitle')}
{isLoading && } {!isError && !isLoading && } - {isError && Nem sikerült betölteni az előadásokat} + {isError && {t('presentations.error')}}
); } diff --git a/app/(tabs)/presentation/index.tsx b/app/(tabs)/presentation/index.tsx index 9734bf5..f8467dd 100644 --- a/app/(tabs)/presentation/index.tsx +++ b/app/(tabs)/presentation/index.tsx @@ -21,7 +21,7 @@ export default function PresentationListPage() { - Kedvenceim + {t('presentations.favorites')} {isLoading && } diff --git a/app/[...unmatched].tsx b/app/[...unmatched].tsx index f54227c..573ab85 100644 --- a/app/[...unmatched].tsx +++ b/app/[...unmatched].tsx @@ -1,4 +1,5 @@ import { useRouter } from 'expo-router'; +import { useTranslation } from 'react-i18next'; import { SafeAreaView } from 'react-native'; import { StyledButton } from '../components/common/styled-button'; @@ -8,14 +9,15 @@ import { usePageView } from '../utils/analytics.utils'; export default function Unmatched() { const { canGoBack, back } = useRouter(); + const { t } = useTranslation(); usePageView('unmatched'); return ( - Ismeretlen képernyőre jutottál - Ilyet mi itt nem tartunk + {t('unmatched.main')} + {t('unmatched.sub')} {canGoBack() && ( - Vissza + {t('unmatched.back')} )} diff --git a/components/common/error-boundary.tsx b/components/common/error-boundary.tsx index 0fd4b27..45fa8c7 100644 --- a/components/common/error-boundary.tsx +++ b/components/common/error-boundary.tsx @@ -1,4 +1,5 @@ import { ErrorBoundaryProps } from 'expo-router'; +import { useTranslation } from 'react-i18next'; import { ScrollView, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; @@ -9,6 +10,7 @@ import { Title } from './title'; export function ErrorBoundary(props: ErrorBoundaryProps) { const { top, bottom, left, right } = useSafeAreaInsets(); + const { t } = useTranslation(); usePageView('error'); return ( - Hopp, ez elszállt :( + {t('errBoundary.main')} {props.error.message} - Kérlek ezt jelezd a fejlesztőknek! + {t('errBoundary.sub')} - Újrapróbálkozás + {t('errBoundary.retry')} ); diff --git a/content/map-resources-en.content.ts b/content/map-resources-en.content.ts new file mode 100644 index 0000000..325b042 --- /dev/null +++ b/content/map-resources-en.content.ts @@ -0,0 +1,174 @@ +import { MapResource } from '../types/map.type'; + +export const MapResources_en: MapResource[] = [ + { + id: 'DOOR', + title: 'Entrance', + description: '', + }, + { + id: 'COFFEE', + title: 'Chill corner', + description: 'Relax with a cup of coffee in hand!', + }, + { + id: 'IB028', + title: 'IB028 Lecture Hall', + description: '', + }, + { + id: 'IB025', + title: 'IB025 Lecture Hall', + description: '', + }, + { + id: 'VIP', + title: 'VIP', + description: '', + }, + { + id: 'ORG', + title: 'Organizers', + description: '', + }, + { + id: 'K1', + title: 'Kör', + description: 'Ez itt egy szakmai kör.', + }, + { + id: 'K4', + title: 'Kör', + description: 'Ez itt egy szakmai kör.', + }, + { + id: 'K5', + title: 'Kör', + description: 'Ez itt egy szakmai kör.', + }, + { + id: 'K2', + title: 'Kör', + description: 'Ez itt egy szakmai kör.', + }, + { + id: 'K3', + title: 'Kör', + description: 'Ez itt egy szakmai kör.', + }, + { + id: 'T5', + title: 'Department', + description: 'This is a department.', + }, + { + id: 'T4', + title: 'Department', + description: 'This is a department.', + }, + { + id: 'T3', + title: 'Department', + description: 'This is a department.', + }, + { + id: 'T2', + title: 'Department', + description: 'This is a department.', + }, + { + id: 'T1', + title: 'Department', + description: 'This is a department.', + }, + { + id: 'C9', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C8', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C7', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C6', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C5', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C4', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C3', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C12', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C13', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C14', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C15', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C10', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C11', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C2', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'C1', + title: 'Company', + description: 'This is a Company.', + }, + { + id: 'WC', + title: 'Toilet', + description: '', + }, + { + id: 'WC_2', + title: 'Toilet', + description: '', + }, + { + id: 'WC_3', + title: 'Toilet', + description: '', + }, +]; diff --git a/content/map-resources.content.ts b/content/map-resources-hu.content.ts similarity index 98% rename from content/map-resources.content.ts rename to content/map-resources-hu.content.ts index 6643366..02b57f6 100644 --- a/content/map-resources.content.ts +++ b/content/map-resources-hu.content.ts @@ -1,6 +1,6 @@ import { MapResource } from '../types/map.type'; -export const MapResources: MapResource[] = [ +export const MapResources_hu: MapResource[] = [ { id: 'DOOR', title: 'Bejárat', diff --git a/services/i18n_data.ts b/services/i18n_data.ts index 66a023d..80dd424 100644 --- a/services/i18n_data.ts +++ b/services/i18n_data.ts @@ -14,15 +14,30 @@ export const resources = { empty: 'No presentations available.', noNews: 'No news available', }, - persentations: { + presentations: { title: 'Schedule', error: 'Unable load presentations', empty: 'No presentations available.', + favorites: 'Favorites', + favoritesTitle: 'Favorite presentations', }, news: { highlight: 'Highlight', error: "Encountered an error while loading the news. Perhaps it doesn't exist?", }, + map: { + key: 'en', + }, + unmatched: { + main: 'You have reached an unmatched route', + sub: 'Please return to the previous page', + back: 'Back', + }, + errBoundary: { + main: 'Whoops! The app has ran into a problem :(', + sub: 'Please contact the developers', + retry: 'Retry', + }, }, }, hu: { @@ -40,15 +55,30 @@ export const resources = { empty: 'Nincs megjeleníthető előadás.', noNews: 'Nincs megjeleníthető hír.', }, - persentations: { + presentations: { title: 'Programterv', error: 'Nem sikerült betölteni az előadásokat', empty: 'Nincs megjeleníthető előadás.', + favorites: 'Kedvenceim', + favoritesTitle: 'Kedvenc előadásaim', }, news: { highlight: 'Kiemelt', error: 'Hiba történt a hír betöltése közben. Lehet, hogy ez a hír nem is létezik?', }, + map: { + key: 'hu', + }, + unmatched: { + main: 'Ismeretlen képernyőre jutottál', + sub: 'Ilyet mi itt nem tartunk', + back: 'Vissza', + }, + errBoundary: { + main: 'Hopp, ez elszállt :(', + sub: 'Kérlek ezt jelezd a fejlesztőknek!', + retry: 'Újrapróbálkozás', + }, }, }, };