[+] i18n for status messages

pull/23/head
Azalea 2024-03-18 01:55:22 -04:00
parent e1cdb3ab65
commit f1461f905d
3 changed files with 22 additions and 10 deletions

View File

@ -5,6 +5,7 @@
import type { ConfirmProps } from "../libs/generalTypes";
import { DISCORD_INVITE } from "../libs/config";
import Icon from "@iconify/svelte";
import { t } from "../libs/i18n"
// Props
export let confirm: ConfirmProps | null = null
@ -26,9 +27,9 @@
// Set to null
confirm = null
}}>Cancel</button>
}}>{t('action.cancel')}</button>
{/if}
<button on:click={() => confirm && confirm.confirm()} class:error={confirm.dangerous}>Confirm</button>
<button on:click={() => confirm && confirm.confirm()} class:error={confirm.dangerous}>{t('action.confirm')}</button>
</div>
</div>
</div>
@ -37,16 +38,13 @@
{#if error}
<div class="overlay" transition:fade>
<div>
<h2 class="error">Error</h2>
<span>Something went wrong, please try again later or <a href={DISCORD_INVITE}>join our discord for support.</a></span>
<span>Detail: {error}</span>
<!-- <div class="actions">-->
<!-- <button on:click={() => error = null}>Close</button>-->
<!-- </div>-->
<h2 class="error">{t('status.error')}</h2>
<span>{t('status.error.hint')}<a href={DISCORD_INVITE}>{t('status.error.hint.link')}</a></span>
<span>{t('status.detail', { detail: error })}</span>
<div class="actions">
<button on:click={() => location.reload()} class="error">
Refresh
{t('action.refresh')}
</button>
</div>
</div>
@ -86,4 +84,4 @@
margin-left: 20px
font-size: 1.5rem
</style>
</style>

View File

@ -59,6 +59,13 @@ export const EN_REF_GENERAL = {
'game.mai2': "Mai",
'game.chu3': "Chuni",
'game.ongeki': "Ongeki",
'status.error': "Error",
'status.error.hint': 'Something went wrong, please try again later or ',
'status.error.hint.link': 'join our discord for support.',
'status.detail': 'Detail: ${detail}',
'action.refresh': 'Refresh',
'action.cancel': 'Cancel',
'action.confirm': 'Confirm',
}
export const EN_REF = { ...EN_REF_USER, ...EN_REF_Welcome, ...EN_REF_GENERAL, ...EN_REF_LEADERBOARD }

View File

@ -61,6 +61,13 @@ const zhGeneral: typeof EN_REF_GENERAL = {
'game.mai2': "舞萌",
'game.chu3': "中二",
'game.ongeki': "音击",
"status.error": "发生错误",
"status.error.hint": "出了一些问题,请稍后刷新重试或者",
"status.error.hint.link": "加我们的 Discord 群问一问",
"status.detail": "详细信息:${detail}",
"action.refresh": "刷新",
"action.cancel": "取消",
"action.confirm": "确认",
}
export const ZH = { ...zhUser, ...zhWelcome, ...zhGeneral, ...zhLeaderboard }