From fe9c73a8f0eee304b15b0065ff9f7bb407c42db3 Mon Sep 17 00:00:00 2001 From: Simon Caron <8635747+simoncaron@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:52:34 -0500 Subject: [PATCH] Library Translation --- app/(auth)/(tabs)/(libraries)/[libraryId].tsx | 7 +++++-- app/(auth)/(tabs)/(libraries)/_layout.tsx | 5 ++++- app/(auth)/(tabs)/(libraries)/index.tsx | 5 ++++- translations/en.json | 6 ++++++ translations/fr.json | 6 ++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/(auth)/(tabs)/(libraries)/[libraryId].tsx b/app/(auth)/(tabs)/(libraries)/[libraryId].tsx index 7d5679a1..0b7cd1e2 100644 --- a/app/(auth)/(tabs)/(libraries)/[libraryId].tsx +++ b/app/(auth)/(tabs)/(libraries)/[libraryId].tsx @@ -42,6 +42,7 @@ import { import { FlashList } from "@shopify/flash-list"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { colletionTypeToItemType } from "@/utils/collectionTypeToItemType"; +import { useTranslation } from "react-i18next"; const Page = () => { const searchParams = useLocalSearchParams(); @@ -63,6 +64,8 @@ const Page = () => { const { orientation } = useOrientation(); + const { t } = useTranslation(); + useEffect(() => { const sop = getSortOrderPreference(libraryId, sortOrderPreference); if (sop) { @@ -437,7 +440,7 @@ const Page = () => { if (flatData.length === 0) return ( - No items found + {t("library.no_items_found")} ); @@ -446,7 +449,7 @@ const Page = () => { key={orientation} ListEmptyComponent={ - No results + {t("library.no_results")} } contentInsetAdjustmentBehavior="automatic" diff --git a/app/(auth)/(tabs)/(libraries)/_layout.tsx b/app/(auth)/(tabs)/(libraries)/_layout.tsx index 489a20e5..42626d43 100644 --- a/app/(auth)/(tabs)/(libraries)/_layout.tsx +++ b/app/(auth)/(tabs)/(libraries)/_layout.tsx @@ -4,10 +4,13 @@ import { Ionicons } from "@expo/vector-icons"; import { Stack } from "expo-router"; import { Platform } from "react-native"; import * as DropdownMenu from "zeego/dropdown-menu"; +import { useTranslation } from "react-i18next"; export default function IndexLayout() { const [settings, updateSettings] = useSettings(); + const { t } = useTranslation(); + if (!settings?.libraryOptions) return null; return ( @@ -17,7 +20,7 @@ export default function IndexLayout() { options={{ headerShown: true, headerLargeTitle: true, - headerTitle: "Library", + headerTitle: t("library.library_title"), headerBlurEffect: "prominent", headerTransparent: Platform.OS === "ios" ? true : false, headerShadowVisible: false, diff --git a/app/(auth)/(tabs)/(libraries)/index.tsx b/app/(auth)/(tabs)/(libraries)/index.tsx index ef729254..4ca1cef4 100644 --- a/app/(auth)/(tabs)/(libraries)/index.tsx +++ b/app/(auth)/(tabs)/(libraries)/index.tsx @@ -13,6 +13,7 @@ import { useAtom } from "jotai"; import { useEffect } from "react"; import { StyleSheet, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; +import { useTranslation } from "react-i18next"; export default function index() { const [api] = useAtom(apiAtom); @@ -54,6 +55,8 @@ export default function index() { } }, [data]); + const { t } = useTranslation(); + const insets = useSafeAreaInsets(); if (isLoading) @@ -66,7 +69,7 @@ export default function index() { if (!data) return ( - No libraries found + {t("library.no_libraries_found")} ); diff --git a/translations/en.json b/translations/en.json index 8073d7cb..f6f45a1d 100644 --- a/translations/en.json +++ b/translations/en.json @@ -33,6 +33,12 @@ "search_hint": "Search here...", "no_results_found_for": "No results found for" }, + "library": { + "library_title": "Library", + "no_items_found": "No items found", + "no_results": "No results", + "no_libraries_found": "No libraries found" + }, "tabs": { "home": "Home", "search": "Search", diff --git a/translations/fr.json b/translations/fr.json index 2c367816..a913d3ac 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -33,6 +33,12 @@ "search_hint": "Rechercher ici...", "no_results_found_for": "Aucun résultat trouvé pour" }, + "library": { + "library_title": "Bibliothèque", + "no_items_found": "Aucun item trouvé", + "no_results": "Aucun résultat", + "no_libraries_found": "Aucune bibliothèque trouvée" + }, "tabs": { "home": "Accueil", "search": "Recherche",