Skip to content

Commit

Permalink
docs:add i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Feb 8, 2023
1 parent e3f63b5 commit c912563
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default defineConfig({
items: [
{ text: '入门', link: '/guide/start' },
{ text: '配置', link: '/guide/option' },
{ text: '国际化', link: '/guide/i18n' },
{ text: '数据结构', link: '/guide/schema' }
]
},
Expand Down
8 changes: 8 additions & 0 deletions docs/guide/command-execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,4 +526,12 @@ instance.command.executeInsertElementList(IElement[])
用法:
```javascript
instance.command.executeRemoveControl()
```

## executeSetLocale
功能:设置本地语言

用法:
```javascript
instance.command.executeSetLocale(locale)
```
81 changes: 81 additions & 0 deletions docs/guide/i18n.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 国际化

## 使用方式

```javascript
import Editor from "@hufe921/canvas-editor"

const instance = new Editor(container, <IElement[]>data, options)

// 注册
instance.register.langMap(locale: string, lang: ILang)

// 设置
instance.command.executeSetLocale(locale)
```

## ILang

```typescript
interface ILang {
contextmenu: {
global: {
cut: string;
copy: string;
paste: string;
selectAll: string;
print: string;
};
control: {
delete: string;
};
hyperlink: {
delete: string;
cancel: string;
edit: string;
};
image: {
change: string;
saveAs: string;
textWrap: string;
textWrapType: {
embed: string;
upDown: string;
}
};
table: {
insertRowCol: string;
insertTopRow: string;
insertBottomRow: string;
insertLeftCol: string;
insertRightCol: string;
deleteRowCol: string;
deleteRow: string;
deleteCol: string;
deleteTable: string;
mergeCell: string;
mergeCancelCell: string;
};
};
datePicker: {
now: string;
confirm: string;
return: string;
timeSelect: string;
weeks: {
sun: string;
mon: string;
tue: string;
wed: string;
thu: string;
fri: string;
sat: string;
};
year: string;
month: string;
hour: string;
minute: string;
second: string;
};
}
```

0 comments on commit c912563

Please sign in to comment.