From cdab715463ecdc9f3cbd233edbd40f7c53a3aa1c Mon Sep 17 00:00:00 2001 From: tapframe Date: Tue, 6 Jan 2026 13:18:31 +0530 Subject: [PATCH] updated tab navigator for localization --- src/i18n/locales/en.json | 7 +++++++ src/i18n/locales/pt.json | 7 +++++++ src/navigation/AppNavigator.tsx | 22 ++++++++++++---------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 50575e30..e2fe9244 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -11,6 +11,13 @@ "ok": "OK", "unknown": "Unknown" }, + "navigation": { + "home": "Home", + "library": "Library", + "search": "Search", + "downloads": "Downloads", + "settings": "Settings" + }, "addons": { "title": "Addons", "reorder_mode": "Reorder Mode", diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json index b9845ab6..5d4efaeb 100644 --- a/src/i18n/locales/pt.json +++ b/src/i18n/locales/pt.json @@ -11,6 +11,13 @@ "ok": "OK", "unknown": "Desconhecido" }, + "navigation": { + "home": "Início", + "library": "Biblioteca", + "search": "Buscar", + "downloads": "Downloads", + "settings": "Configurações" + }, "addons": { "title": "Addons", "reorder_mode": "Modo de Reordenação", diff --git a/src/navigation/AppNavigator.tsx b/src/navigation/AppNavigator.tsx index 11dcba1f..d895012c 100644 --- a/src/navigation/AppNavigator.tsx +++ b/src/navigation/AppNavigator.tsx @@ -17,6 +17,7 @@ import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-cont import { useTheme } from '../contexts/ThemeContext'; import { PostHogProvider } from 'posthog-react-native'; import { ScrollToTopProvider, useScrollToTopEmitter } from '../contexts/ScrollToTopContext'; +import { useTranslation } from 'react-i18next'; // Optional iOS Glass effect (expo-glass-effect) with safe fallback let GlassViewComp: any = null; @@ -545,6 +546,7 @@ const WrappedScreen: React.FC<{ Screen: React.ComponentType }> = ({ Screen // Tab Navigator const MainTabs = () => { + const { t } = useTranslation(); const { currentTheme } = useTheme(); const { settings } = require('../hooks/useSettings'); const { useSettings: useSettingsHook } = require('../hooks/useSettings'); @@ -915,7 +917,7 @@ const MainTabs = () => { name="Home" component={HomeScreen} options={{ - title: 'Home', + title: t('navigation.home'), tabBarIcon: () => ({ sfSymbol: 'house' }), freezeOnBlur: true, }} @@ -931,7 +933,7 @@ const MainTabs = () => { name="Library" component={LibraryScreen} options={{ - title: 'Library', + title: t('navigation.library'), tabBarIcon: () => ({ sfSymbol: 'heart' }), }} listeners={({ navigation }: { navigation: any }) => ({ @@ -946,7 +948,7 @@ const MainTabs = () => { name="Search" component={SearchScreen} options={{ - title: 'Search', + title: t('navigation.search'), tabBarIcon: () => ({ sfSymbol: 'magnifyingglass' }), }} listeners={({ navigation }: { navigation: any }) => ({ @@ -962,7 +964,7 @@ const MainTabs = () => { name="Downloads" component={DownloadsScreen} options={{ - title: 'Downloads', + title: t('navigation.downloads'), tabBarIcon: () => ({ sfSymbol: 'arrow.down.circle' }), }} listeners={({ navigation }: { navigation: any }) => ({ @@ -978,7 +980,7 @@ const MainTabs = () => { name="Settings" component={SettingsScreen} options={{ - title: 'Settings', + title: t('navigation.settings'), tabBarIcon: () => ({ sfSymbol: 'gear' }), }} listeners={({ navigation }: { navigation: any }) => ({ @@ -1053,7 +1055,7 @@ const MainTabs = () => { name="Home" component={HomeScreen} options={{ - tabBarLabel: 'Home', + tabBarLabel: t('navigation.home'), tabBarIcon: ({ color, size, focused }) => ( ), @@ -1064,7 +1066,7 @@ const MainTabs = () => { name="Library" component={LibraryScreen} options={{ - tabBarLabel: 'Library', + tabBarLabel: t('navigation.library'), tabBarIcon: ({ color, size, focused }) => ( ), @@ -1074,7 +1076,7 @@ const MainTabs = () => { name="Search" component={SearchScreen} options={{ - tabBarLabel: 'Search', + tabBarLabel: t('navigation.search'), tabBarIcon: ({ color, size }) => ( ), @@ -1085,7 +1087,7 @@ const MainTabs = () => { name="Downloads" component={DownloadsScreen} options={{ - tabBarLabel: 'Downloads', + tabBarLabel: t('navigation.downloads'), tabBarIcon: ({ color, size, focused }) => ( ), @@ -1096,7 +1098,7 @@ const MainTabs = () => { name="Settings" component={SettingsScreen} options={{ - tabBarLabel: 'Settings', + tabBarLabel: t('navigation.settings'), tabBarIcon: ({ color, size, focused }) => ( ),