File tree Expand file tree Collapse file tree 2 files changed +43
-43
lines changed Expand file tree Collapse file tree 2 files changed +43
-43
lines changed Original file line number Diff line number Diff line change 1
- import React , { createContext } from 'react' ;
1
+ import React from 'react' ;
2
2
3
- export interface Locale {
4
- locale : string ;
5
- BlockHeader : { expand : string ; collapse : string } ;
6
- Copy : { copied : string ; copy : string } ;
7
- Dropdown : { selectAll : string ; resetText : string ; okText : string } ;
8
- Fullscreen : { exitFull : string ; full : string } ;
9
- GlobalLoading : { loading : string } ;
10
- Input : {
11
- case : string ;
12
- precise : string ;
13
- front : string ;
14
- tail : string ;
15
- } ;
16
- LoadError : {
17
- please : string ;
18
- get : string ;
19
- refresh : string ;
20
- title : string ;
21
- } ;
22
- Modal : {
23
- okText : string ;
24
- cancelText : string ;
25
- } ;
26
- MxGraph : { newNode : string } ;
27
- NotFound : {
28
- description : string ;
29
- } ;
30
- SpreadSheet : {
31
- description : string ;
32
- copy : string ;
33
- copyAll : string ;
34
- } ;
35
- }
36
-
37
- export interface LocaleContextProps {
38
- locale : Locale ;
39
- }
40
-
41
- export const LocaleContext = createContext < LocaleContextProps > ( { locale : { } as Locale } ) ;
3
+ import { LocaleContext , LocaleContextProps } from '../locale/useLocale' ;
42
4
43
5
const ConfigProvider = ( {
44
6
locale,
Original file line number Diff line number Diff line change 1
- import { useContext , useMemo } from 'react' ;
1
+ import { createContext , useContext , useMemo } from 'react' ;
2
2
3
- import type { Locale , LocaleContextProps } from '../configProvider' ;
4
- import { LocaleContext } from '../configProvider' ;
5
3
import defaultLocaleData from './zh-CN' ;
6
4
5
+ export interface Locale {
6
+ locale : string ;
7
+ BlockHeader : { expand : string ; collapse : string } ;
8
+ Copy : { copied : string ; copy : string } ;
9
+ Dropdown : { selectAll : string ; resetText : string ; okText : string } ;
10
+ Fullscreen : { exitFull : string ; full : string } ;
11
+ GlobalLoading : { loading : string } ;
12
+ Input : {
13
+ case : string ;
14
+ precise : string ;
15
+ front : string ;
16
+ tail : string ;
17
+ } ;
18
+ LoadError : {
19
+ please : string ;
20
+ get : string ;
21
+ refresh : string ;
22
+ title : string ;
23
+ } ;
24
+ Modal : {
25
+ okText : string ;
26
+ cancelText : string ;
27
+ } ;
28
+ MxGraph : { newNode : string } ;
29
+ NotFound : {
30
+ description : string ;
31
+ } ;
32
+ SpreadSheet : {
33
+ description : string ;
34
+ copy : string ;
35
+ copyAll : string ;
36
+ } ;
37
+ }
38
+
39
+ export interface LocaleContextProps {
40
+ locale : Locale ;
41
+ }
42
+
43
+ export const LocaleContext = createContext < LocaleContextProps > ( { locale : { } as Locale } ) ;
44
+
7
45
export type LocaleComponentName = keyof Locale ;
8
46
9
47
const useLocale = < C extends LocaleComponentName = LocaleComponentName > (
You can’t perform that action at this time.
0 commit comments