11import { useDisplayTrack } from '@flow/player'
2- import { formatFileSize , formatTime } from '@flow/shared'
2+ import { formatFileSize , formatTime , useTranslation } from '@flow/shared'
33import { Image , StyleSheet , View } from 'react-native'
44import { Text } from 'react-native-paper'
55import Animated from 'react-native-reanimated'
66import { usePlayerContext } from './Context'
77
88export default function TrackInfo ( ) {
9+ const { t } = useTranslation ( )
910 const { artworkColors } = usePlayerContext ( )
1011 const displayTrack = useDisplayTrack ( )
1112
@@ -16,28 +17,26 @@ export default function TrackInfo() {
1617 contentContainerStyle = { styles . container }
1718 >
1819 < View style = { [ styles . group , { backgroundColor : `${ artworkColors . background } 20` } ] } >
19- < Text style = { styles . header } > 音频信息 </ Text >
20+ < Text style = { styles . header } > { t ( 'player.trackInfo.audioInfo' ) } </ Text >
2021 < View style = { styles . audioSingleRow } >
2122 < View style = { styles . audioCompactCard } >
22- < Text style = { styles . audioCompactLabel } > 格式 </ Text >
23+ < Text style = { styles . audioCompactLabel } > { t ( 'player.trackInfo.format' ) } </ Text >
2324 < Text style = { styles . audioCompactValue } > { displayTrack ?. format ?. toUpperCase ( ) || '--' } </ Text >
2425 </ View >
2526 < View style = { styles . audioCompactCard } >
26- < Text style = { styles . audioCompactLabel } > 声道 </ Text >
27+ < Text style = { styles . audioCompactLabel } > { t ( 'player.trackInfo.channels' ) } </ Text >
2728 < Text style = { styles . audioCompactValue } >
2829 { displayTrack ?. channels || '--' }
29- { ' ' }
30- channels
3130 </ Text >
3231 </ View >
3332 < View style = { styles . audioCompactCard } >
34- < Text style = { styles . audioCompactLabel } > 比特率 </ Text >
33+ < Text style = { styles . audioCompactLabel } > { t ( 'player.trackInfo.bitrate' ) } </ Text >
3534 < Text style = { styles . audioCompactValue } >
3635 { displayTrack ?. bitrate ? `${ displayTrack . bitrate } kbps` : '--' }
3736 </ Text >
3837 </ View >
3938 < View style = { styles . audioCompactCard } >
40- < Text style = { styles . audioCompactLabel } > 采样率 </ Text >
39+ < Text style = { styles . audioCompactLabel } > { t ( 'player.trackInfo.sampleRate' ) } </ Text >
4140 < Text style = { styles . audioCompactValue } >
4241 { displayTrack ?. sampleRate ? `${ displayTrack . sampleRate } hz` : '--' }
4342 </ Text >
@@ -46,7 +45,7 @@ export default function TrackInfo() {
4645 </ View >
4746
4847 < View style = { [ styles . group , { backgroundColor : `${ artworkColors . background } 20` } ] } >
49- < Text style = { styles . header } > 专辑 </ Text >
48+ < Text style = { styles . header } > { t ( 'player.trackInfo.album' ) } </ Text >
5049 < View style = { styles . content } >
5150 < Image
5251 source = { { uri : displayTrack ?. artwork } }
@@ -57,31 +56,31 @@ export default function TrackInfo() {
5756 </ View >
5857
5958 < View style = { [ styles . group , { backgroundColor : `${ artworkColors . background } 20` } ] } >
60- < Text style = { styles . header } > 艺术家 </ Text >
59+ < Text style = { styles . header } > { t ( 'player.trackInfo.artist' ) } </ Text >
6160 < View style = { styles . content } >
6261 < Text > { displayTrack ?. artist } </ Text >
6362 </ View >
6463 </ View >
6564
6665 < View style = { [ styles . group , { backgroundColor : `${ artworkColors . background } 20` } ] } >
67- < Text style = { styles . header } > 文件信息 </ Text >
66+ < Text style = { styles . header } > { t ( 'player.trackInfo.fileInfo' ) } </ Text >
6867
6968 < View style = { styles . fileInfoItem } >
70- < Text style = { styles . label } > 文件路径 </ Text >
69+ < Text style = { styles . label } > { t ( 'player.trackInfo.filePath' ) } </ Text >
7170 < Text style = { styles . pathText } numberOfLines = { 2 } ellipsizeMode = "middle" >
7271 { displayTrack ?. url }
7372 </ Text >
7473 </ View >
7574 < View style = { styles . fileInfoItem } >
76- < Text style = { styles . label } > 文件大小 </ Text >
75+ < Text style = { styles . label } > { t ( 'player.trackInfo.fileSize' ) } </ Text >
7776 < Text style = { styles . value } > { formatFileSize ( displayTrack ?. fileSize ?? 0 ) } </ Text >
7877 </ View >
7978 < View style = { styles . fileInfoItem } >
80- < Text style = { styles . label } > 创建时间 </ Text >
79+ < Text style = { styles . label } > { t ( 'player.trackInfo.createdTime' ) } </ Text >
8180 < Text style = { styles . value } > { formatTime ( displayTrack ?. createdAt ) } </ Text >
8281 </ View >
8382 < View style = { [ styles . fileInfoItem , { marginBottom : 0 } ] } >
84- < Text style = { styles . label } > 修改时间 </ Text >
83+ < Text style = { styles . label } > { t ( 'player.trackInfo.modifiedTime' ) } </ Text >
8584 < Text style = { styles . value } > { formatTime ( displayTrack ?. modifiedAt ) } </ Text >
8685 </ View >
8786 </ View >
0 commit comments