fix: format time

This commit is contained in:
KUN1007 2023-08-25 17:27:27 +08:00
parent 70d797df17
commit 4db6747d60
4 changed files with 20 additions and 17 deletions

View file

@ -1,6 +1,6 @@
export default {
header: {
name: '鲲Galgame',
name: '鲲 Galgame',
pool: '所有话题',
create: '发布话题',
technique: '技术交流',
@ -46,22 +46,22 @@ export default {
item: {
daily: '日常交流',
chat: '闲聊灌水',
execute: 'galgame运行相关',
globalization: 'galgame汉化相关',
make: 'galgame制作相关',
execute: 'Galgame 运行相关',
globalization: 'Galgame 汉化相关',
make: 'Galgame 制作相关',
privacy: '隐私政策',
principle: '运营理念',
balance: '收支公示',
acgngame: 'ACGNGAME',
shinnku: '失落的小站',
ymgal: '月幕galgame',
ymgal: '月幕 galgame',
},
describe: {
title: '鲲Galgame',
kun1: '世界上最萌的 galgame 论坛!',
kun2: '鲲galgame以营造最良好的氛围为理念',
kun3: '鲲galgame永远不会有广告',
kun4: '鲲galgame永远不会收费',
title: '鲲 Galgame',
kun1: '世界上最萌的 Galgame 论坛!',
kun2: '鲲 Galgame 以营造最良好的氛围为理念',
kun3: '鲲 Galgame 永远不会有广告',
kun4: '鲲 Galgame 永远不会收费',
},
contact: '联系我们',
},

View file

@ -4,10 +4,10 @@ dayjs.extend(relativeTime)
const languageOptions = {
en: {
second: 'second',
seconds: 'seconds',
minute: 'minute',
minutes: 'minutes',
second: 'sec',
seconds: 'secs',
minute: 'min',
minutes: 'mins',
hour: 'hour',
hours: 'hours',
day: 'day',
@ -42,6 +42,7 @@ function replaceTimeUnits(input: string, language: string) {
(languageOptions as Record<string, any>)[language] || languageOptions.en
const replacements: Record<string, string> = {
a: '1', // 将 "a" 替换为 "1"
second: languageOption.second,
seconds: languageOption.seconds,
minute: languageOption.minute,
@ -86,6 +87,10 @@ export function formatTimeDifference(pastTime: number, language: string) {
}
}
if (time() === 'a few seconds') {
return language === 'en' ? 'a few secs ago' : '几秒前'
}
const cnTime = replaceTimeUnits(time(), language).replace(/s\b/g, '') + hint
const enTime = replaceTimeUnits(time(), language) + hint

View file

@ -134,7 +134,7 @@ const plainText = getPlainText(props.data.content)
}
/* 发帖日期 */
.topic-post-date {
width: 55px;
width: 60px;
font-size: x-small;
color: var(--kungalgame-font-color-0);
/* 居中 */

View file

@ -162,7 +162,6 @@ onMounted(async () => {
/* 设置 fa 图标字体的颜色 */
color: var(--kungalgame-purple-4);
span {
width: 38px;
font-size: xx-small;
/* 右侧区域距离最右侧的距离 */
margin-left: 5px;
@ -179,7 +178,6 @@ onMounted(async () => {
align-items: center;
color: var(--kungalgame-red-4);
span {
width: 38px;
font-size: small;
margin-left: 5px;
color: var(--kungalgame-font-color-3);