4
4
5
5
import * as React from 'react' ;
6
6
import * as Antd from 'antd' ;
7
+ import * as I18Next from 'react-i18next' ;
8
+
7
9
import {
8
10
BgColorsOutlined ,
9
11
CheckOutlined ,
@@ -25,53 +27,54 @@ export interface ThemeModalProps {
25
27
onThemeChange : ( themeKey : string ) => void ;
26
28
}
27
29
28
- const THEME_OPTIONS : ThemeOption [ ] = [
29
- {
30
- key : 'light' ,
31
- name : 'Light Theme' ,
32
- icon : < SunOutlined /> ,
33
- description : 'Clean and bright interface for daytime use' ,
34
- } ,
35
- {
36
- key : 'dark' ,
37
- name : 'Dark Theme' ,
38
- icon : < MoonOutlined /> ,
39
- description : 'Easy on the eyes for low-light environments' ,
40
- } ,
41
- {
42
- key : 'tritanopia' ,
43
- name : 'Tritanopia Theme' ,
44
- icon : < SunOutlined /> ,
45
- description : 'Designed for those with Tritanopia color blindness' ,
46
- } ,
47
- {
48
- key : 'tritanopia-dark' ,
49
- name : 'Tritanopia Dark' ,
50
- icon : < MoonOutlined /> ,
51
- description : 'Dark theme for those with Tritanopia color blindness' ,
52
- } ,
53
- {
54
- key : 'deuteranopia' ,
55
- name : 'Deuteranopia Theme' ,
56
- icon : < SunOutlined /> ,
57
- description : 'Designed for those with Deuteranopia color blindness' ,
58
- } ,
59
- {
60
- key : 'deuteranopia-dark' ,
61
- name : 'Deuteranopia Dark' ,
62
- icon : < MoonOutlined /> ,
63
- description : 'Dark theme for those with Deuteranopia color blindness' ,
64
- } ,
65
- ] ;
66
-
67
30
const ThemeModal : React . FC < ThemeModalProps > = ( {
68
31
open,
69
32
onClose,
70
33
currentTheme,
71
34
onThemeChange,
72
35
} ) => {
36
+ const { t } = I18Next . useTranslation ( ) ;
73
37
const [ selectedTheme , setSelectedTheme ] = React . useState ( currentTheme ) ;
74
38
39
+ const THEME_OPTIONS : ThemeOption [ ] = [
40
+ {
41
+ key : 'light' ,
42
+ name : t ( 'THEME_MODAL.LIGHT' ) ,
43
+ icon : < SunOutlined /> ,
44
+ description : t ( 'THEME_MODAL.LIGHT_DESCRIPTION' ) ,
45
+ } ,
46
+ {
47
+ key : 'dark' ,
48
+ name : t ( 'THEME_MODAL.DARK' ) ,
49
+ icon : < MoonOutlined /> ,
50
+ description : t ( 'THEME_MODAL.DARK_DESCRIPTION' ) ,
51
+ } ,
52
+ {
53
+ key : 'tritanopia' ,
54
+ name : t ( 'THEME_MODAL.TRITANOPIA' ) ,
55
+ icon : < SunOutlined /> ,
56
+ description : t ( 'THEME_MODAL.TRITANOPIA_DESCRIPTION' ) ,
57
+ } ,
58
+ {
59
+ key : 'tritanopia-dark' ,
60
+ name : t ( 'THEME_MODAL.TRITANOPIA_DARK' ) ,
61
+ icon : < MoonOutlined /> ,
62
+ description : t ( 'THEME_MODAL.TRITANOPIA_DARK_DESCRIPTION' ) ,
63
+ } ,
64
+ {
65
+ key : 'deuteranopia' ,
66
+ name : t ( 'THEME_MODAL.DEUTERANOPIA' ) ,
67
+ icon : < SunOutlined /> ,
68
+ description : t ( 'THEME_MODAL.DEUTERANOPIA_DESCRIPTION' ) ,
69
+ } ,
70
+ {
71
+ key : 'deuteranopia-dark' ,
72
+ name : t ( 'THEME_MODAL.DEUTERANOPIA_DARK' ) ,
73
+ icon : < MoonOutlined /> ,
74
+ description : t ( 'THEME_MODAL.DEUTERANOPIA_DARK_DESCRIPTION' ) ,
75
+ } ,
76
+ ] ;
77
+
75
78
React . useEffect ( ( ) => {
76
79
setSelectedTheme ( currentTheme ) ;
77
80
} , [ currentTheme ] ) ;
@@ -95,30 +98,30 @@ const ThemeModal: React.FC<ThemeModalProps> = ({
95
98
title = {
96
99
< div style = { { display : 'flex' , alignItems : 'center' , gap : 8 } } >
97
100
< BgColorsOutlined />
98
- Theme Selection
101
+ { t ( 'THEME_MODAL.SELECTION' ) }
99
102
</ div >
100
103
}
101
104
open = { open }
102
105
onCancel = { handleCancel }
103
106
footer = { [
104
107
< Antd . Button key = "cancel" onClick = { handleCancel } >
105
- Cancel
108
+ { t ( 'CANCEL' ) }
106
109
</ Antd . Button > ,
107
110
< Antd . Button
108
111
key = "apply"
109
112
type = "primary"
110
113
onClick = { handleApplyTheme }
111
114
disabled = { selectedTheme === currentTheme }
112
115
>
113
- Apply Theme
116
+ { t ( 'THEME_MODAL.APPLY' ) }
114
117
</ Antd . Button > ,
115
118
] }
116
119
width = { 600 }
117
120
destroyOnHidden
118
121
>
119
122
< div style = { { padding : '16px 0' } } >
120
123
< Antd . Typography . Text type = "secondary" style = { { marginBottom : 16 , display : 'block' } } >
121
- Choose a theme that best suits your preference and working environment.
124
+ { t ( 'THEME_MODAL.CHOOSE_DESCRIPTION' ) }
122
125
</ Antd . Typography . Text >
123
126
124
127
< Antd . Row gutter = { [ 16 , 16 ] } >
@@ -176,7 +179,7 @@ const ThemeModal: React.FC<ThemeModalProps> = ({
176
179
< div style = { { marginTop : 12 } } >
177
180
< div style = { { display : 'flex' , gap : 4 , alignItems : 'center' } } >
178
181
< Antd . Button size = "small" type = "primary" >
179
- Primary
182
+ { t ( 'THEME_MODAL.PRIMARY_BUTTON' ) }
180
183
</ Antd . Button >
181
184
</ div >
182
185
</ div >
@@ -190,8 +193,8 @@ const ThemeModal: React.FC<ThemeModalProps> = ({
190
193
< Antd . Divider />
191
194
192
195
< Antd . Alert
193
- message = "Theme Preview"
194
- description = "The selected theme will be applied to the entire application interface."
196
+ message = { t ( 'THEME_MODAL.PREVIEW' ) }
197
+ description = { t ( 'THEME_MODAL.PREVIEW_DESCRIPTION' ) }
195
198
type = "info"
196
199
showIcon
197
200
style = { { marginTop : 16 } }
0 commit comments