修复 i18n-ally 插件的语言识别问题,修复内置列表名称语言切换显示问题

This commit is contained in:
lyswhut 2024-12-22 01:10:49 +08:00
parent 5302e7b892
commit 7a6d068c8c
6 changed files with 28 additions and 15 deletions

View File

@ -3,9 +3,9 @@
"src/lang"
],
// "i18n-ally.fullReloadOnChanged": true,
"i18n-ally.keystyle": "nested",
"i18n-ally.displayLanguage": "zh_cn",
"i18n-ally.sourceLanguage": "zh_cn",
"i18n-ally.keystyle": "flat",
"i18n-ally.displayLanguage": "zh-cn",
"i18n-ally.sourceLanguage": "zh-cn",
"i18n-ally.translate.engines": [
"google-cn",
"google"

View File

@ -114,7 +114,7 @@
"list_sort_modal_by_up": "Ascending order",
"list_sync": "Update",
"list_sync_confirm_tip": "This will replace the songs in {name} with the songs in the online list, are you sure you want to update?",
"list_temp": "Temp list",
"list_name_temp": "Temp list",
"list_update_error": "{name} failed to update",
"list_update_success": "{name} updated successfully",
"list_updating": "updating",

View File

@ -1,6 +1,6 @@
import zh_cn from './zh_cn.json'
import zh_tw from './zh_tw.json'
import en_us from './en_us.json'
import zh_cn from './zh-cn.json'
import zh_tw from './zh-tw.json'
import en_us from './en-us.json'
type Message = Record<keyof typeof zh_cn, string>
| Record<keyof typeof zh_tw, string>
@ -21,7 +21,6 @@ const langs = [
locale: 'zh_tw',
// alternate: 'zh-hant',
country: 'cn',
fallback: true,
message: zh_tw,
},
{

View File

@ -114,7 +114,7 @@
"list_sort_modal_by_up": "升序",
"list_sync": "更新",
"list_sync_confirm_tip": "这将会把「{name}」内的歌曲替换成在线列表的歌曲,你确认要更新吗?",
"list_temp": "临时列表",
"list_name_temp": "临时列表",
"list_update_error": "「{name}」更新失败",
"list_update_success": "「{name}」更新成功",
"list_updating": "更新中",

View File

@ -82,6 +82,9 @@
"list_multi_add_title_first_add": "添加已選的",
"list_multi_add_title_first_move": "移動已選的",
"list_multi_add_title_last": "首歌曲到...",
"list_name_default": "試聽列表",
"list_name_love": "我的收藏",
"list_name_temp": "臨時清單",
"list_remove": "移除",
"list_remove_music_multi_tip": "你真的想要移除所選的 {num} 首歌曲嗎?",
"list_remove_tip": "你真的想要移除「{name}」嗎?",
@ -112,7 +115,6 @@
"list_sort_modal_by_up": "升序",
"list_sync": "更新",
"list_sync_confirm_tip": "這將會把「{name}」內的歌曲取代成線上清單的歌曲,你確認要更新嗎?",
"list_temp": "臨時清單",
"list_update_error": "「{name}」更新失敗",
"list_update_success": "「{name}」更新成功",
"list_updating": "更新中",
@ -300,11 +302,11 @@
"setting_list_click_action": "點擊清單裡的歌曲時自動切換到目前清單播放(僅對歌單、排行榜有效)",
"setting_list_show interval": "顯示歌曲時長",
"setting_list_show_album_name": "顯示歌曲專輯",
"setting_lyric_desktop_permission_tip": "桌面歌詞功能需要在系統權限設定中授予 LX Music 「重疊顯示於其他應用程式上方」權限才能使用,是否去相關頁面授予該權限?",
"setting_lyric_desktop": "桌面歌詞",
"setting_lyric_desktop_enable": "顯示桌面歌詞",
"setting_lyric_desktop_lock": "鎖定歌詞",
"setting_lyric_desktop_maxlineNum": "最大行數",
"setting_lyric_desktop_permission_tip": "桌面歌詞功能需要在系統權限設定中授予 LX Music 「重疊顯示於其他應用程式上方」權限才能使用,是否去相關頁面授予該權限?",
"setting_lyric_desktop_single_line": "使用單行歌詞",
"setting_lyric_desktop_text_opacity": "歌詞字體透明度",
"setting_lyric_desktop_text_size": "歌詞字體大小",

View File

@ -1,4 +1,4 @@
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react'
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react'
import { TouchableOpacity } from 'react-native'
import { Icon } from '@/components/common/Icon'
@ -12,6 +12,7 @@ import { setActiveList } from '@/core/list'
import Text from '@/components/common/Text'
import { LIST_IDS } from '@/config/constant'
import Loading from '@/components/common/Loading'
import { useSettingValue } from '@/store/setting/hook'
export interface ActiveListProps {
onShowSearchBar: () => void
@ -25,9 +26,20 @@ export default forwardRef<ActiveListType, ActiveListProps>(({ onShowSearchBar, o
const theme = useTheme()
const currentListId = useActiveListId()
const fetching = useListFetching(currentListId)
let currentListName = currentListId == LIST_IDS.TEMP
? global.i18n.t(`list_${LIST_IDS.TEMP}`)
: listState.allList.find(l => l.id === currentListId)?.name ?? ''
const langId = useSettingValue('common.langId')
const currentListName = useMemo(() => {
switch (currentListId) {
case LIST_IDS.TEMP:
return global.i18n.t('list_name_temp')
case LIST_IDS.DEFAULT:
return global.i18n.t('list_name_default')
case LIST_IDS.LOVE:
return global.i18n.t('list_name_love')
default:
return listState.allList.find(l => l.id === currentListId)?.name ?? ''
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentListId, langId])
const [visibleBar, setVisibleBar] = useState(true)
useImperativeHandle(ref, () => ({