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

@@ -164,12 +164,12 @@ const OptionStar = withSuspenseMemo<{
additionalText?: string
}>(({ id, type, additionalText: text }) => {
const { query, toggle } = useStar(id, type)
const { t } = useTranslation('context.actions')
const { t } = useTranslation()
return (
<ContextMenuIconTextOption
IconComponentRaw={<Star starred={!!query.data} size={26} />}
text={(query.data ? t('unstar') : t('star')) + (text ? ` ${text}` : '')}
text={(query.data ? t('unstar') : t('context.actions.star')) + (text ? ` ${text}` : '')}
onSelect={() => toggle.mutate()}
/>
)
@@ -180,7 +180,7 @@ const OptionViewArtist = withSuspenseMemo<{
artist?: string
artistId?: string
}>(({ navigation, artist, artistId }) => {
const { t } = useTranslation('resources.artist.actions')
const { t } = useTranslation()
if (!artist || !artistId) {
return <></>
@@ -192,7 +192,7 @@ const OptionViewArtist = withSuspenseMemo<{
name="microphone"
size={26}
text={t('view')}
onSelect={() => navigation.navigate('artist', { id: artistId, title: artist })}
onSelect={() => navigation.navigate('resources.artist.actions.artist', { id: artistId, title: artist })}
/>
)
})
@@ -202,7 +202,7 @@ const OptionViewAlbum = withSuspenseMemo<{
album?: string
albumId?: string
}>(({ navigation, album, albumId }) => {
const { t } = useTranslation('resources.album.actions')
const { t } = useTranslation()
if (!album || !albumId) {
return <></>
@@ -214,7 +214,7 @@ const OptionViewAlbum = withSuspenseMemo<{
name="compact-disc"
size={26}
text={t('view')}
onSelect={() => navigation.navigate('album', { id: albumId, title: album })}
onSelect={() => navigation.navigate('resources.album.actions.album', { id: albumId, title: album })}
/>
)
})

View File

@@ -17,7 +17,7 @@ const ListPlayerControls = withSuspenseMemo<{
disabled?: boolean
}>(({ listType, style, play, shuffle, disabled }) => {
const [downloaded, setDownloaded] = useState(false)
const { t } = useTranslation('resources')
const { t } = useTranslation()
return (
<View style={[styles.controls, style]}>
@@ -34,7 +34,7 @@ const ListPlayerControls = withSuspenseMemo<{
</Button>
</View>
<View style={styles.controlsCenter}>
<Button title={t(`${listType}.actions.play`)} disabled={disabled} onPress={play} />
<Button title={t(`resources.${listType}.actions.play`)} disabled={disabled} onPress={play} />
</View>
<View style={styles.controlsSide}>
<Button disabled={disabled} onPress={shuffle}>

View File

@@ -10,7 +10,7 @@ const NothingHere = withSuspenseMemo<{
width?: number
style?: ViewStyle
}>(({ height, width, style }) => {
const { t } = useTranslation('messages')
const { t } = useTranslation()
height = height || 200
width = width || 200
@@ -18,7 +18,7 @@ const NothingHere = withSuspenseMemo<{
<View style={[styles.container, { height, width }, style]}>
<Icon name="music-rest-quarter" color={styles.text.color} size={width / 2} />
<Text style={[styles.text, { fontSize: width / 8 }]} numberOfLines={3}>
{t('nothingHere')}
{t('messages.nothingHere')}
</Text>
</View>
)