Skip to content

Commit 70754d5

Browse files
authored
Merge pull request #378 from SSShooter/feature/locale-refactor
Feature/locale refactor
2 parents 14ff39b + da60d1d commit 70754d5

18 files changed

Lines changed: 331 additions & 230 deletions

File tree

build.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const buildList = [
3030
enrty: __dirname + './src/utils/plaintextConverter.ts',
3131
formats: ['es'],
3232
},
33+
{
34+
name: 'i18n',
35+
enrty: __dirname + './src/i18n.ts',
36+
formats: ['es'],
37+
},
3338
]
3439
for (let i = 0; i < buildList.length; i++) {
3540
const info = buildList[i]

package.json

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mind-elixir",
3-
"version": "5.9.3",
3+
"version": "5.10.0-beta.1",
44
"type": "module",
55
"description": "Mind elixir is a free open source mind map core.",
66
"keywords": [
@@ -10,7 +10,6 @@
1010
"visualization"
1111
],
1212
"scripts": {
13-
"prepare": "husky install",
1413
"lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
1514
"dev": "vite",
1615
"build": "node build.js && tsc",
@@ -28,21 +27,18 @@
2827
"exports": {
2928
".": {
3029
"types": "./dist/types/index.d.ts",
31-
"import": "./dist/MindElixir.js",
32-
"require": "./dist/MindElixir.js"
30+
"import": "./dist/MindElixir.js"
3331
},
3432
"./lite": {
3533
"import": "./dist/MindElixirLite.iife.js"
3634
},
3735
"./example": {
3836
"types": "./dist/types/exampleData/1.d.ts",
39-
"import": "./dist/example.js",
40-
"require": "./dist/example.js"
37+
"import": "./dist/example.js"
4138
},
4239
"./LayoutSsr": {
4340
"types": "./dist/types/utils/LayoutSsr.d.ts",
44-
"import": "./dist/LayoutSsr.js",
45-
"require": "./dist/LayoutSsr.js"
41+
"import": "./dist/LayoutSsr.js"
4642
},
4743
"./readme.md": "./readme.md",
4844
"./package.json": "./package.json",
@@ -51,13 +47,10 @@
5147
"./plaintextConverter": {
5248
"types": "./dist/types/utils/plaintextConverter.d.ts",
5349
"import": "./dist/PlaintextConverter.js"
54-
}
55-
},
56-
"typesVersions": {
57-
"*": {
58-
"example": [
59-
"./dist/types/exampleData/1.d.ts"
60-
]
50+
},
51+
"./i18n": {
52+
"types": "./dist/types/i18n.d.ts",
53+
"import": "./dist/i18n.js"
6154
}
6255
},
6356
"main": "dist/MindElixir.js",

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ And in your CSS file:
180180

181181
```javascript
182182
import MindElixir from 'mind-elixir'
183+
import { en } from 'mind-elixir/i18n'
183184
import 'mind-elixir/style.css'
184185
import example from 'mind-elixir/dist/example1'
185186

@@ -188,11 +189,10 @@ let options = {
188189
direction: MindElixir.LEFT,
189190
toolBar: true, // default true
190191
keypress: true, // default true
191-
locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] waiting for PRs
192192
overflowHidden: false, // default false
193-
mainLinkStyle: 2, // [1,2] default 1
194193
mouseSelectionButton: 0, // 0 for left button, 2 for right button, default 0
195194
contextMenu: {
195+
locale: en, // [cn,zh_CN,zh_TW,en,ru,ja,pt,it,es,fr,ko,ro,da,fi,de,nl,nb,sv]
196196
focus: true,
197197
link: true,
198198
extend: [

readme/es.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Y en tu archivo CSS:
160160

161161
```javascript
162162
import MindElixir from 'mind-elixir'
163+
import { es } from 'mind-elixir/i18n'
163164
import example from 'mind-elixir/dist/example1'
164165

165166
let options = {
@@ -169,11 +170,10 @@ let options = {
169170
contextMenu: true, // por defecto true
170171
toolBar: true, // por defecto true
171172
keypress: true, // por defecto true
172-
locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] esperando PRs
173173
overflowHidden: false, // por defecto false
174-
mainLinkStyle: 2, // [1,2] por defecto 1
175174
mouseSelectionButton: 0, // 0 para botón izquierdo, 2 para botón derecho, por defecto 0
176-
contextMenuOption: {
175+
contextMenu: {
176+
locale: es,
177177
focus: true,
178178
link: true,
179179
extend: [

readme/fr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Et dans votre fichier CSS :
137137

138138
```javascript
139139
import MindElixir from 'mind-elixir'
140+
import { fr } from 'mind-elixir/i18n'
140141
import example from 'mind-elixir/dist/example1'
141142

142143
let options = {
@@ -146,11 +147,10 @@ let options = {
146147
contextMenu: true, // par défaut true
147148
toolBar: true, // par défaut true
148149
keypress: true, // par défaut true
149-
locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] en attente de PRs
150150
overflowHidden: false, // par défaut false
151-
mainLinkStyle: 2, // [1,2] par défaut 1
152151
mouseSelectionButton: 0, // 0 pour le bouton gauche, 2 pour le bouton droit, par défaut 0
153-
contextMenuOption: {
152+
contextMenu: {
153+
locale: fr,
154154
focus: true,
155155
link: true,
156156
extend: [

readme/ja.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ CSSファイルに追加:
160160

161161
```javascript
162162
import MindElixir from 'mind-elixir'
163+
import { ja } from 'mind-elixir/i18n'
163164
import example from 'mind-elixir/dist/example1'
164165

165166
let options = {
@@ -169,11 +170,10 @@ let options = {
169170
contextMenu: true, // デフォルトはtrue
170171
toolBar: true, // デフォルトはtrue
171172
keypress: true, // デフォルトはtrue
172-
locale: 'ja', // [zh_CN,zh_TW,en,ja,pt,ru,ro] PRs募集中
173173
overflowHidden: false, // デフォルトはfalse
174-
mainLinkStyle: 2, // [1,2] デフォルトは1
175174
mouseSelectionButton: 0, // 0は左クリック、2は右クリック、デフォルトは0
176-
contextMenuOption: {
175+
contextMenu: {
176+
locale: ja,
177177
focus: true,
178178
link: true,
179179
extend: [

readme/ko.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,18 @@ import MindElixir from 'mind-elixir'
137137

138138
```javascript
139139
import MindElixir from 'mind-elixir'
140+
import { ko } from 'mind-elixir/i18n'
140141
import example from 'mind-elixir/dist/example1'
141142

142143
let options = {
143144
el: '#map', // or HTMLDivElement
144145
direction: MindElixir.LEFT,
145146
draggable: true, // default true
146-
contextMenu: true, // default true
147-
toolBar: true, // default true
148147
keypress: true, // default true
149-
locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] waiting for PRs
150148
overflowHidden: false, // default false
151-
mainLinkStyle: 2, // [1,2] default 1
152149
mouseSelectionButton: 0, // 0 for left button, 2 for right button, default 0
153-
contextMenuOption: {
150+
contextMenu: {
151+
locale: ko,
154152
focus: true,
155153
link: true,
156154
extend: [

readme/pt.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,19 @@ E no seu arquivo CSS:
137137

138138
```javascript
139139
import MindElixir from 'mind-elixir'
140+
import { pt } from 'mind-elixir/i18n'
140141
import example from 'mind-elixir/dist/example1'
141142

142143
let options = {
143144
el: '#map', // ou HTMLDivElement
144145
direction: MindElixir.LEFT,
145146
draggable: true, // padrão true
146-
contextMenu: true, // padrão true
147147
toolBar: true, // padrão true
148148
keypress: true, // padrão true
149-
locale: 'pt', // [zh_CN,zh_TW,en,ja,pt,ru,ro] aguardando PRs
150149
overflowHidden: false, // padrão false
151-
mainLinkStyle: 2, // [1,2] padrão 1
152150
mouseSelectionButton: 0, // 0 para botão esquerdo, 2 para botão direito, padrão 0
153-
contextMenuOption: {
151+
contextMenu: {
152+
locale: pt,
154153
focus: true,
155154
link: true,
156155
extend: [

readme/ru.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,18 @@ import MindElixir from 'mind-elixir'
137137

138138
```javascript
139139
import MindElixir from 'mind-elixir'
140+
import { en } from 'mind-elixir/i18n'
140141
import example from 'mind-elixir/dist/example1'
141142

142143
let options = {
143144
el: '#map', // or HTMLDivElement
144145
direction: MindElixir.LEFT,
145146
draggable: true, // default true
146-
contextMenu: true, // default true
147-
toolBar: true, // default true
148147
keypress: true, // default true
149-
locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] waiting for PRs
150148
overflowHidden: false, // default false
151-
mainLinkStyle: 2, // [1,2] default 1
152149
mouseSelectionButton: 0, // 0 for left button, 2 for right button, default 0
153-
contextMenuOption: {
150+
contextMenu: {
151+
locale: en,
154152
focus: true,
155153
link: true,
156154
extend: [

readme/zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ import MindElixir from 'mind-elixir'
160160

161161
```javascript
162162
import MindElixir from 'mind-elixir'
163+
import { en } from 'mind-elixir/i18n'
163164
import example from 'mind-elixir/dist/example1'
164165

165166
let options = {
@@ -169,11 +170,10 @@ let options = {
169170
contextMenu: true, // 默认 true
170171
toolBar: true, // 默认 true
171172
keypress: true, // 默认 true
172-
locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] 等待 PRs
173173
overflowHidden: false, // 默认 false
174-
mainLinkStyle: 2, // [1,2] 默认 1
175174
mouseSelectionButton: 0, // 0 为左键,2 为右键,默认 0
176175
contextMenuOption: {
176+
locale: en, // [cn,zh_CN,zh_TW,en,ru,ja,pt,it,es,fr,ko,ro,da,fi,de,nl,nb,sv]
177177
focus: true,
178178
link: true,
179179
extend: [

0 commit comments

Comments
 (0)