Skip to content

Commit 9955c0e

Browse files
committed
feat: 支持国际化
1 parent 10fca30 commit 9955c0e

File tree

10 files changed

+236
-209
lines changed

10 files changed

+236
-209
lines changed

messages/en.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "Template Drawer",
3+
"description": "",
4+
"label": "Template",
5+
"title": "",
6+
"tip": "",
7+
8+
"drawer": {
9+
10+
}
11+
}

messages/zh.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "样板",
3+
"description": "",
4+
"label": "样板",
5+
"title": "",
6+
"tip": "",
7+
8+
"drawer": {
9+
10+
}
11+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
"version": "1.0.0",
44
"plugin": {
55
"id": "template-drawer",
6+
"namespace": "plugins.template-drawer",
67
"type": "DRAWER",
78
"theme": "BLUE",
89
"port": {
910
"dev": 8080,
1011
"debug": 8081
11-
},
12-
"namespace": "template-drawer"
12+
}
1313
},
1414
"main": "dist/index.js",
1515
"types": "dist/index.d.ts",
1616
"scripts": {
1717
"dev": "webpack serve --config webpack.config.js",
18+
"build": "webpack --config webpack.config.js",
1819
"test": "echo All tests passed.",
19-
"build": "webpack --config webpack.production.config.js",
2020
"commit": "node scripts/commit.js",
2121
"type:check": "tsc --noEmit",
2222
"lint": "eslint --fix .",

src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import Plugin from './plugin'
2-
import messages from './messages/dev'
3-
import packageJson from '../package.json'
42

5-
window.nfpConnector.loadMessages({ [packageJson.plugin.namespace]: messages })
63
window.nfpConnector.install(new Plugin())
74

85
export { Plugin }

src/messages/dev.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/messages/en.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/messages/zh.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/plugin.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export default class Plugin implements DrawerPlugin {
2020
type: PluginType = packageJson.plugin.type as PluginType
2121
theme: ThemeColor = packageJson.plugin.theme as ThemeColor
2222

23+
label = this.intl`label`
24+
title = this.intl`title`
25+
tip = this.intl`tip`
2326
weight = 50
24-
title = ''
25-
tip = ''
2627
position = IconPluginPosition.TOP_LEFT
2728
group = ''
28-
label = ''
2929
color = packageJson.plugin.theme as ThemeColor
3030
open = false
3131

0 commit comments

Comments
 (0)