[O] More i18n

This commit is contained in:
2025-11-23 15:07:07 +08:00
parent a45316bd16
commit 6f7df5361b
6 changed files with 103 additions and 13 deletions
+27 -1
View File
@@ -134,5 +134,31 @@ export default {
title: 'Oops!',
message: 'The page youre looking for doesnt exist. It might have been removed, renamed, or never existed.\n\n </br></br> Go back to the <a class="error-page__link" href="/">homepage</a> to continue browsing',
return: 'Return home',
}
},
player: {
menu: {
showFuri: 'Show Furigana',
hideFuri: 'Hide Furigana',
revertHiragana: 'Revert to Hiragana',
convertToKatakana: 'Convert all to Katakana',
showRomaji: 'Show Romaji',
hideRomaji: 'Hide Romaji',
showRomajiOnError: 'Show Romaji on Error',
hideRomajiOnError: 'Don\'t Show Romaji on Error',
musicModeUnavailable: 'Not available in music mode',
showRepeated: 'Show Repeated Lines',
hideRepeated: 'Hide Repeated Lines',
shuffle: 'Current: Shuffle',
sequential: 'Current: Sequential',
nextSong: 'Next Song'
}
},
dialog: {
close: 'Close',
error: {
title: 'Error',
refresh: 'Refresh to Retry'
}
},
components: {}
}
+27 -1
View File
@@ -134,5 +134,31 @@ export default {
title: 'おっと!',
message: 'お探しのページは見つかりませんでした。削除されたか、名前が変更されたか、あるいは最初から存在しなかった可能性があります。\n\n </br></br> <a class="error-page__link" href="/">トップページ</a> に戻って閲覧を続けてください',
return: 'トップページに戻る',
}
},
player: {
menu: {
showFuri: 'ふりがなを表示',
hideFuri: 'ふりがなを隠す',
revertHiragana: 'ひらがなに戻す',
convertToKatakana: 'すべてカタカナに変換',
showRomaji: 'ローマ字を表示',
hideRomaji: 'ローマ字を隠す',
showRomajiOnError: 'エラー時にローマ字を表示',
hideRomajiOnError: 'エラー時にローマ字を表示しない',
musicModeUnavailable: '音楽モードでは利用できません',
showRepeated: '重複行を表示',
hideRepeated: '重複行を隠す',
shuffle: '現在:シャッフル再生',
sequential: '現在:順次再生',
nextSong: '次の曲'
}
},
dialog: {
close: '閉じる',
error: {
title: 'エラー',
refresh: '更新して再試行'
}
},
components: {}
}
+28
View File
@@ -134,5 +134,33 @@ export default {
title: '页面不存在',
message: '很抱歉,您访问的页面不存在。可能已被删除、更名,或链接输入错误。\n\n </br></br> 返回 <a class="error-page__link" href="/">首页</a> 继续浏览',
return: '返回首页',
},
player: {
menu: {
showFuri: '显示假名标注',
hideFuri: '隐藏假名标注',
revertHiragana: '恢复平假名',
convertToKatakana: '全部转换为片假名',
showRomaji: '显示罗马音',
hideRomaji: '隐藏罗马音',
showRomajiOnError: '错误时显示罗马音',
hideRomajiOnError: '不在错误时显示罗马音',
musicModeUnavailable: '音乐模式下不可用',
showRepeated: '显示重复行',
hideRepeated: '隐藏重复行',
shuffle: '当前:随机播放',
sequential: '当前:顺序播放',
nextSong: '下首'
}
},
dialog: {
close: '关闭',
error: {
title: '错误',
refresh: '刷新重试'
}
},
components: {
}
}
+12 -8
View File
@@ -7,6 +7,8 @@
import { API } from "$lib/client"
import { getNextSong, getNextLoc } from "./SongSwitching"
import { getI18n } from "$lib/i18n"
interface Props {
song: NeteaseSong
settings: TypingSettings
@@ -27,6 +29,8 @@
isKaraoke = false
}: Props = $props()
const t = getI18n().player.menu
let isHideRepeated = $derived(settings.hideRepeated && !disableHideRepeated)
const nextSongId = $derived(getNextSong(playlist, loc))
@@ -48,27 +52,27 @@
</script>
<AppBar title={song.name} sub={artistAndAlbum(song)}>
<MenuItem textIcon="あ" onclick={() => settings.isFuri = !settings.isFuri}>{settings.isFuri ? "隐藏" : "显示"}假名标注</MenuItem>
<MenuItem textIcon="カ" onclick={() => settings.allKata = !settings.allKata}>{settings.allKata ? "恢复平假名" : "全部转换为片假名"}</MenuItem>
<MenuItem icon="i-material-symbols:language-japanese-kana-rounded" onclick={() => settings.showRomaji = !settings.showRomaji}>{settings.showRomaji ? "隐藏罗马音" : "显示罗马音"}</MenuItem>
<MenuItem textIcon="あ" onclick={() => settings.isFuri = !settings.isFuri}>{settings.isFuri ? t.hideFuri : t.showFuri}</MenuItem>
<MenuItem textIcon="カ" onclick={() => settings.allKata = !settings.allKata}>{settings.allKata ? t.revertHiragana : t.convertToKatakana}</MenuItem>
<MenuItem icon="i-material-symbols:language-japanese-kana-rounded" onclick={() => settings.showRomaji = !settings.showRomaji}>{settings.showRomaji ? t.hideRomaji : t.showRomaji}</MenuItem>
{#if showRomajiOnError}
<MenuItem icon="i-material-symbols:error-circle-rounded" onclick={() => settings.showRomajiOnError = !settings.showRomajiOnError}>{settings.showRomajiOnError ? "不在错误时显示罗马音" : "错误时显示罗马音"}</MenuItem>
<MenuItem icon="i-material-symbols:error-circle-rounded" onclick={() => settings.showRomajiOnError = !settings.showRomajiOnError}>{settings.showRomajiOnError ? t.hideRomajiOnError : t.showRomajiOnError}</MenuItem>
{/if}
<MenuItem icon="i-material-symbols:compress-rounded"
disabled={disableHideRepeated}
sub={disableHideRepeated ? "音乐模式下不可用" : ""}
onclick={() => settings.hideRepeated = !settings.hideRepeated}>{isHideRepeated ? "显示重复行" : "隐藏重复行"}</MenuItem>
sub={disableHideRepeated ? t.musicModeUnavailable : ""}
onclick={() => settings.hideRepeated = !settings.hideRepeated}>{isHideRepeated ? t.showRepeated : t.hideRepeated}</MenuItem>
{#if loc}
<MenuItem icon={loc.playMode === 'random' ? "i-material-symbols:shuffle-rounded" : "i-material-symbols:repeat-rounded"}
onclick={() => loc!.playMode = loc!.playMode === 'random' ? 'sequential' : 'random'}>
{loc.playMode === 'random' ? "当前:随机播放" : "当前:顺序播放"}
{loc.playMode === 'random' ? t.shuffle : t.sequential}
</MenuItem>
{#if nextSongId}
<MenuItem icon="i-material-symbols:skip-next-rounded" onclick={handleNext}>下首</MenuItem>
<MenuItem icon="i-material-symbols:skip-next-rounded" onclick={handleNext}>{t.nextSong}</MenuItem>
{/if}
{/if}
</AppBar>
+4 -1
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import { Layer } from "m3-svelte"
import { fade } from "svelte/transition"
import { getI18n } from "$lib/i18n"
let { open = $bindable(), ...p }: {
title: string,
@@ -13,8 +14,10 @@
noClose?: boolean
} = $props()
const t = getI18n().dialog
let buttons = $derived([...(p.buttons ?? []), ...(p.noClose ? [] : [{
text: '关闭', onclick: () => open = false
text: t.close, onclick: () => open = false
}])])
</script>
+5 -2
View File
@@ -1,15 +1,18 @@
<script lang="ts">
import Dialog from "./Dialog.svelte";
import { getI18n } from "$lib/i18n"
let p: {
error?: string
} = $props()
const t = getI18n().dialog.error
let open = $derived(!!p.error)
</script>
<Dialog title="错误" bind:open buttons={[{
text: "刷新重试",
<Dialog title={t.title} bind:open buttons={[{
text: t.refresh,
onclick: () => location.reload()
}]} noClose>
<div class="text-red-500">