Skip to content

Commit 5b56c90

Browse files
committed
chore: add Locale type
1 parent c649222 commit 5b56c90

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/i18n.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type LangPack = {
1111
clickTips: string
1212
summary: string
1313
}
14+
export type Locale = 'cn' | 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'pt' | 'it' | 'es'
1415
const cn = {
1516
addChild: '插入子节点',
1617
addParent: '插入父节点',
@@ -24,7 +25,7 @@ const cn = {
2425
clickTips: '请点击目标节点',
2526
summary: '摘要',
2627
}
27-
const i18n: Record<string, LangPack> = {
28+
const i18n: Record<Locale, LangPack> = {
2829
cn,
2930
zh_CN: cn,
3031
zh_TW: {

src/types/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { Arrow } from '../arrow'
77
import type { Summary, SummarySvgGroup } from '../summary'
88
import type SelectionArea from '@viselect/vanilla'
99
import type { MainLineParams, SubLineParams } from '../utils/generateBranch'
10+
import type { Locale } from '../i18n'
1011
export * from '../methods'
1112

1213
type Before = Partial<{
@@ -113,7 +114,7 @@ type PathString = string
113114
export type Options = {
114115
el: string | HTMLElement
115116
direction?: number
116-
locale?: string
117+
locale?: Locale
117118
draggable?: boolean
118119
editable?: boolean
119120
contextMenu?: boolean

0 commit comments

Comments
 (0)