Skip to content

Commit 3b632ba

Browse files
committed
feat: add track info i18n
1 parent 9d16aa8 commit 3b632ba

File tree

5 files changed

+84
-17
lines changed

5 files changed

+84
-17
lines changed

apps/mobile/modules/player/TrackInfo.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { useDisplayTrack } from '@flow/player'
2-
import { formatFileSize, formatTime } from '@flow/shared'
2+
import { formatFileSize, formatTime, useTranslation } from '@flow/shared'
33
import { Image, StyleSheet, View } from 'react-native'
44
import { Text } from 'react-native-paper'
55
import Animated from 'react-native-reanimated'
66
import { usePlayerContext } from './Context'
77

88
export 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>
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import common from './common'
22
import home from './home'
33
import navigation from './navigation'
4+
import player from './player'
45
import setting from './setting'
56

67
export default {
78
common,
89
home,
9-
setting,
1010
navigation,
11+
player,
12+
setting,
1113
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export default {
2+
trackInfo: {
3+
audioInfo: 'Audio Info',
4+
format: 'Format',
5+
channels: 'Channels',
6+
bitrate: 'Bitrate',
7+
sampleRate: 'Sample',
8+
album: 'Album',
9+
artist: 'Artist',
10+
fileInfo: 'File Info',
11+
filePath: 'File Path',
12+
fileSize: 'File Size',
13+
createdTime: 'Created Time',
14+
modifiedTime: 'Modified Time',
15+
channelsUnit: 'channels',
16+
},
17+
18+
playback: {
19+
play: 'Play',
20+
pause: 'Pause',
21+
next: 'Next',
22+
previous: 'Previous',
23+
shuffle: 'Shuffle',
24+
repeat: 'Repeat',
25+
},
26+
27+
queue: {
28+
nowPlaying: 'Now Playing',
29+
upNext: 'Up Next',
30+
clear: 'Clear Queue',
31+
},
32+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import common from './common'
22
import home from './home'
33
import navigation from './navigation'
4+
import player from './player'
45
import setting from './setting'
56

67
export default {
78
common,
89
home,
9-
setting,
1010
navigation,
11+
player,
12+
setting,
1113
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export default {
2+
trackInfo: {
3+
audioInfo: '音频信息',
4+
format: '格式',
5+
channels: '声道',
6+
bitrate: '比特率',
7+
sampleRate: '采样率',
8+
album: '专辑',
9+
artist: '艺术家',
10+
fileInfo: '文件信息',
11+
filePath: '文件路径',
12+
fileSize: '文件大小',
13+
createdTime: '创建时间',
14+
modifiedTime: '修改时间',
15+
channelsUnit: '声道',
16+
},
17+
18+
playback: {
19+
play: '播放',
20+
pause: '暂停',
21+
next: '下一首',
22+
previous: '上一首',
23+
shuffle: '随机播放',
24+
repeat: '重复播放',
25+
},
26+
27+
queue: {
28+
nowPlaying: '正在播放',
29+
upNext: '待播放',
30+
clear: '清空队列',
31+
},
32+
}

0 commit comments

Comments
 (0)