fix: Duplicate template options (#51)

* fix: Duplicate template options

* fix: form option i18n text
This commit is contained in:
仓鼠
2024-12-14 10:16:33 +08:00
committed by GitHub
parent 8c8d3e3057
commit d67b9ff4d2
11 changed files with 46 additions and 128 deletions

View File

@@ -1,6 +1,6 @@
import i18next from "i18next"
import { TFunction } from "i18next"
export const triggerModes: Record<number, string> = {
0: i18next.t("Always"),
1: i18next.t("Once"),
}
export const triggerModes = (t: TFunction<"translation", undefined>) => ({
0: t("Always"),
1: t("Once"),
})

View File

@@ -1,12 +1,12 @@
import i18next from "i18next"
import { TFunction } from "i18next"
export const cronTypes: Record<number, string> = {
0: i18next.t("Scheduled"),
1: i18next.t("Trigger"),
}
export const cronTypes = (t: TFunction<"translation", undefined>) => ({
0: t("Scheduled"),
1: t("Trigger"),
})
export const cronCoverageTypes: Record<number, string> = {
0: i18next.t("Coverages.Only"),
1: i18next.t("Coverages.Excludes"),
2: i18next.t("Coverages.Alarmed"),
}
export const cronCoverageTypes = (t: TFunction<"translation", undefined>) => ({
0: t("Coverages.Only"),
1: t("Coverages.Excludes"),
2: t("Coverages.Alarmed"),
})

View File

@@ -1,4 +1,4 @@
import i18next from "i18next"
import { TFunction } from "i18next"
export const serviceTypes: Record<number, string> = {
1: "HTTP GET",
@@ -6,7 +6,7 @@ export const serviceTypes: Record<number, string> = {
3: "TCPing",
}
export const serviceCoverageTypes: Record<number, string> = {
0: i18next.t("Coverages.Excludes"),
1: i18next.t("Coverages.Only"),
}
export const serviceCoverageTypes = (t: TFunction<"translation", undefined>) => ({
0: t("Coverages.Excludes"),
1: t("Coverages.Only"),
})

View File

@@ -1,9 +1,9 @@
import i18next from "i18next"
import { TFunction } from "i18next"
export const settingCoverageTypes: Record<number, string> = {
1: i18next.t("Coverages.Excludes"),
2: i18next.t("Coverages.Only"),
}
export const settingCoverageTypes = (t: TFunction<"translation", undefined>) => ({
1: t("Coverages.Excludes"),
2: t("Coverages.Only"),
})
export const nezhaLang: Record<string, string> = {
"zh-CN": "简体中文(中国大陆)",
@@ -11,8 +11,8 @@ export const nezhaLang: Record<string, string> = {
"en-US": "English",
}
export const wafBlockReasons: Record<number, string> = {
1: i18next.t("LoginFailed"),
2: i18next.t("BruteForceAttackingToken"),
3: i18next.t("BruteForceAttackingAgentSecret"),
}
export const wafBlockReasons = (t: TFunction<"translation", undefined>) => ({
1: t("LoginFailed"),
2: t("BruteForceAttackingToken"),
3: t("BruteForceAttackingAgentSecret"),
})