Add Chinese translation (Thank you copilot, and I swear I reviewed the code carefully)
This commit is contained in:
1 parent
77cdf19f7d
commit
e9d8a1c842
16 files changed
+324
-68
No files matched your search
@@ -3,6 +3,7 @@ import { getColor } from '@/util/color'
|
||||
import { Box, Tooltip, Modal } from '@mantine/core'
|
||||
import { useResizeObserver } from '@mantine/hooks'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
const moment = require('moment')
|
||||
require('moment-precise-range-plugin')
|
||||
|
||||
@@ -13,6 +14,7 @@ export default function DetailBar({
|
||||
monitor: MonitorTarget
|
||||
state: MonitorState
|
||||
}) {
|
||||
const { t } = useTranslation('common')
|
||||
const [barRef, barRect] = useResizeObserver()
|
||||
const [modalOpened, setModalOpened] = useState(false)
|
||||
const [modalTitle, setModalTitle] = useState('')
|
||||
@@ -79,15 +81,21 @@ export default function DetailBar({
|
||||
events={{ hover: true, focus: false, touch: true }}
|
||||
label={
|
||||
Number.isNaN(Number(dayPercent)) ? (
|
||||
'No Data'
|
||||
t('No Data')
|
||||
) : (
|
||||
<>
|
||||
<div>{dayPercent + '% at ' + new Date(dayStart * 1000).toLocaleDateString()}</div>
|
||||
<div>
|
||||
{t('percent at date', {
|
||||
percent: dayPercent,
|
||||
date: new Date(dayStart * 1000).toLocaleDateString(),
|
||||
})}
|
||||
</div>
|
||||
{dayDownTime > 0 && (
|
||||
<div>{`Down for ${moment.preciseDiff(
|
||||
moment(0),
|
||||
moment(dayDownTime * 1000)
|
||||
)} (click for detail)`}</div>
|
||||
<div>
|
||||
{t('Down for', {
|
||||
duration: moment.preciseDiff(moment(0), moment(dayDownTime * 1000)),
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
@@ -105,7 +113,10 @@ export default function DetailBar({
|
||||
onClick={() => {
|
||||
if (dayDownTime > 0) {
|
||||
setModalTitle(
|
||||
`🚨 ${monitor.name} incidents at ${new Date(dayStart * 1000).toLocaleDateString()}`
|
||||
t('incidents at', {
|
||||
name: monitor.name,
|
||||
date: new Date(dayStart * 1000).toLocaleDateString(),
|
||||
})
|
||||
)
|
||||
setModelContent(
|
||||
<>
|
||||
|
||||
Reference in new issue
Block a user