diff --git a/src/lang/en_us.json b/src/lang/en_us.json index e715cea..b5bee3f 100644 --- a/src/lang/en_us.json +++ b/src/lang/en_us.json @@ -49,6 +49,8 @@ "ignoring_battery_optimization_check_tip": "LX Music is not on the list of ignored battery optimization, which may cause the problem of being suspended by the system when playing music in the background. Do you want to add LX Music to the whitelist?", "ignoring_battery_optimization_check_title": "Background running permission setting reminder", "input_error": "Don't input indiscriminately 😡", + "list_name_default": "Default", + "list_name_love": "Loved", "list_add_btn_title": "Add the song(s) to {name}", "list_add_tip_exists": "This song already exists in the list, don't click me again~😡", "list_add_title_first_add": "Add", diff --git a/src/lang/zh_cn.json b/src/lang/zh_cn.json index f8f5730..499b296 100644 --- a/src/lang/zh_cn.json +++ b/src/lang/zh_cn.json @@ -49,6 +49,8 @@ "ignoring_battery_optimization_check_tip": "LX Music 没有在「忽略电池优化」的白名单中,这可能会导致在后台播放音乐时被系统暂停。是否将 LX Music 加入该白名单中?", "ignoring_battery_optimization_check_title": "后台运行权限设置提醒", "input_error": "不要乱输好吧😡", + "list_name_default": "试听列表", + "list_name_love": "我的收藏", "list_add_btn_title": "把该歌曲添加到「{name}」", "list_add_tip_exists": "列表已经存在这首歌啦,不要再点我啦~😡", "list_add_title_first_add": "添加", diff --git a/src/store/list/hook.ts b/src/store/list/hook.ts index 3ae4760..16ed625 100644 --- a/src/store/list/hook.ts +++ b/src/store/list/hook.ts @@ -4,11 +4,23 @@ import { getListMusics } from '@/core/list' export const useMyList = () => { const [lists, setList] = useState(state.allList) + lists[0].name = global.i18n.t('list_name_default') + lists[1].name = global.i18n.t('list_name_love') useEffect(() => { + const handleConfigUpdate = (keys: Array) => { + if (!keys.includes('common.langId')) return + setList((lists) => { + lists[0].name = global.i18n.t('list_name_default') + lists[1].name = global.i18n.t('list_name_love') + return [...lists] + }) + } global.state_event.on('mylistUpdated', setList) + global.state_event.on('configUpdated', handleConfigUpdate) return () => { global.state_event.off('mylistUpdated', setList) + global.state_event.off('configUpdated', handleConfigUpdate) } }, [])