don't use i18n namespaces

there's no need to keep reloading different parts of the object we already cached
This commit is contained in:
austinried
2022-04-16 18:06:06 +09:00
parent b8948fb646
commit 52e95dc959
14 changed files with 120 additions and 79 deletions

View File

@@ -174,7 +174,7 @@ const SettingsTab = () => {
const Tab = createBottomTabNavigator()
const BottomTabNavigator = withSuspense(() => {
const { t } = useTranslation('navigation.tabs')
const { t } = useTranslation()
const firstRun = useFirstRun()
const resetServer = useStore(store => store.resetServer)
@@ -184,12 +184,12 @@ const BottomTabNavigator = withSuspense(() => {
<></>
) : (
<>
<Tab.Screen name="home" component={HomeTab} options={{ tabBarLabel: t('home') }} />
<Tab.Screen name="library" component={LibraryTab} options={{ tabBarLabel: t('library') }} />
<Tab.Screen name="search" component={SearchTab} options={{ tabBarLabel: t('search') }} />
<Tab.Screen name="home" component={HomeTab} options={{ tabBarLabel: t('navigation.tabs.home') }} />
<Tab.Screen name="library" component={LibraryTab} options={{ tabBarLabel: t('navigation.tabs.library') }} />
<Tab.Screen name="search" component={SearchTab} options={{ tabBarLabel: t('navigation.tabs.search') }} />
</>
)}
<Tab.Screen name="settings" component={SettingsTab} options={{ tabBarLabel: t('settings') }} />
<Tab.Screen name="settings" component={SettingsTab} options={{ tabBarLabel: t('navigation.tabs.settings') }} />
</Tab.Navigator>
)
})

View File

@@ -14,9 +14,11 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
const Tab = createMaterialTopTabNavigator()
const LibraryTopTabNavigator = withSuspense(() => {
const { t } = useTranslation('resources')
const { t } = useTranslation()
const marginTop = useSafeAreaInsets().top
console.log('Albums:', t('resources.album.name', { count: 2 }))
return (
<Tab.Navigator
tabBarOptions={{
@@ -25,12 +27,20 @@ const LibraryTopTabNavigator = withSuspense(() => {
indicatorStyle: styles.tabindicatorStyle,
}}
initialRouteName="albums">
<Tab.Screen name="albums" component={AlbumsTab} options={{ tabBarLabel: t('album.name', { count: 2 }) }} />
<Tab.Screen name="artists" component={ArtistsTab} options={{ tabBarLabel: t('artist.name', { count: 2 }) }} />
<Tab.Screen
name="albums"
component={AlbumsTab}
options={{ tabBarLabel: t('resources.album.name', { count: 2 }) }}
/>
<Tab.Screen
name="artists"
component={ArtistsTab}
options={{ tabBarLabel: t('resources.artist.name', { count: 2 }) }}
/>
<Tab.Screen
name="playlists"
component={PlaylistsTab}
options={{ tabBarLabel: t('playlist.name', { count: 2 }) }}
options={{ tabBarLabel: t('resources.playlist.name', { count: 2 }) }}
/>
</Tab.Navigator>
)

View File

@@ -12,7 +12,7 @@ import { createNativeStackNavigator } from 'react-native-screens/native-stack'
const NowPlayingStack = createNativeStackNavigator()
const NowPlayingNavigator = withSuspense(() => {
const { t } = useTranslation('resources.queue')
const { t } = useTranslation()
return (
<NowPlayingStack.Navigator>
@@ -21,7 +21,7 @@ const NowPlayingNavigator = withSuspense(() => {
name="queue"
component={NowPlayingQueue}
options={{
title: t('name'),
title: t('resources.queue.name'),
headerStyle: {
backgroundColor: colors.gradient.high,
},