@@ -28,6 +28,7 @@ import {
28
28
} from "../../../Utils/timeUtils" ;
29
29
import { useNavigate , useParams } from "react-router-dom" ;
30
30
import { buildErrors , hasValidationErrors } from "../../../Validation/error" ;
31
+ import { useTranslation } from "react-i18next" ;
31
32
32
33
const getDurationAndUnit = ( durationInMs ) => {
33
34
if ( durationInMs % MS_PER_DAY === 0 ) {
@@ -113,6 +114,7 @@ const CreateMaintenance = () => {
113
114
const { maintenanceWindowId } = useParams ( ) ;
114
115
const navigate = useNavigate ( ) ;
115
116
const theme = useTheme ( ) ;
117
+ const { t } = useTranslation ( ) ;
116
118
const { user } = useSelector ( ( state ) => state . auth ) ;
117
119
const [ monitors , setMonitors ] = useState ( [ ] ) ;
118
120
const [ search , setSearch ] = useState ( "" ) ;
@@ -293,29 +295,29 @@ const CreateMaintenance = () => {
293
295
component = "span"
294
296
fontSize = "inherit"
295
297
>
296
- { `${ maintenanceWindowId === undefined ? "Create a" : "Edit" } ` } { " " }
298
+ { `${ maintenanceWindowId === undefined ? t ( "createA" ) : t ( "edit" ) } ` } { " " }
297
299
</ Typography >
298
300
< Typography
299
301
component = "span"
300
302
variant = "h2"
301
303
fontSize = "inherit"
302
304
fontWeight = "inherit"
303
305
>
304
- maintenance{ " " }
306
+ { t ( " maintenance" ) } { " " }
305
307
</ Typography >
306
308
< Typography
307
309
component = "span"
308
310
fontSize = "inherit"
309
311
>
310
- window
312
+ { t ( " window" ) }
311
313
</ Typography >
312
314
</ Typography >
313
315
< Typography
314
316
component = "h2"
315
317
variant = "body2"
316
318
fontSize = { 14 }
317
319
>
318
- Your pings won't be sent during this time frame
320
+ { t ( "maintenanceWindowDescription" ) }
319
321
</ Typography >
320
322
</ Box >
321
323
< ConfigBox >
@@ -324,14 +326,14 @@ const CreateMaintenance = () => {
324
326
component = "h2"
325
327
variant = "h2"
326
328
>
327
- General Settings
329
+ { t ( "settingsGeneralSettings" ) }
328
330
</ Typography >
329
331
</ Box >
330
332
< Stack gap = { theme . spacing ( 15 ) } >
331
333
< TextInput
332
334
id = "name"
333
- label = "Friendly name"
334
- placeholder = "Maintenance at __ : __ for ___ minutes"
335
+ label = { t ( "friendlyNameInput" ) }
336
+ placeholder = { t ( "friendlyNamePlaceholder" ) }
335
337
value = { form . name }
336
338
onChange = { ( event ) => {
337
339
handleFormChange ( "name" , event . target . value ) ;
@@ -342,7 +344,7 @@ const CreateMaintenance = () => {
342
344
< Select
343
345
id = "repeat"
344
346
name = "maintenance-repeat"
345
- label = "Maintenance Repeat"
347
+ label = { t ( "maintenanceRepeat" ) }
346
348
value = { getIdByValue ( repeatConfig , form . repeat ) }
347
349
onChange = { ( event ) => {
348
350
handleFormChange (
@@ -437,15 +439,15 @@ const CreateMaintenance = () => {
437
439
component = "h2"
438
440
variant = "h2"
439
441
>
440
- Start time
442
+ { t ( "startTime" ) }
441
443
</ Typography >
442
- < Typography > All dates and times are in GMT+0 time zone. </ Typography >
444
+ < Typography > { t ( "timeZoneInfo" ) } </ Typography >
443
445
</ Box >
444
446
< Stack gap = { theme . spacing ( 15 ) } >
445
447
< LocalizationProvider dateAdapter = { AdapterDayjs } >
446
448
< MobileTimePicker
447
449
id = "startTime"
448
- label = "Start time"
450
+ label = { t ( "startTime" ) }
449
451
value = { form . startTime }
450
452
onChange = { ( newTime ) => {
451
453
handleTimeChange ( "startTime" , newTime ) ;
@@ -486,7 +488,7 @@ const CreateMaintenance = () => {
486
488
< TextInput
487
489
type = "number"
488
490
id = "duration"
489
- label = "Duration"
491
+ label = { t ( "duration" ) }
490
492
value = { form . duration }
491
493
onChange = { ( event ) => {
492
494
handleFormChange ( "duration" , event . target . value ) ;
@@ -516,13 +518,13 @@ const CreateMaintenance = () => {
516
518
component = "h2"
517
519
variant = "h2"
518
520
>
519
- Monitors to apply maintenance window to
521
+ { t ( "monitorsToApply" ) }
520
522
</ Typography >
521
523
</ Box >
522
524
< Stack gap = { theme . spacing ( 15 ) } >
523
525
< Search
524
526
id = { "monitors" }
525
- label = "Add monitors"
527
+ label = { t ( "addMonitors" ) }
526
528
multiple = { true }
527
529
isAdorned = { false }
528
530
options = { monitors ? monitors : [ ] }
@@ -547,7 +549,7 @@ const CreateMaintenance = () => {
547
549
onClick = { ( ) => navigate ( "/maintenance" ) }
548
550
sx = { { mr : theme . spacing ( 6 ) } }
549
551
>
550
- Cancel
552
+ { t ( "cancel" ) }
551
553
</ Button >
552
554
< Button
553
555
loading = { isLoading }
@@ -558,8 +560,8 @@ const CreateMaintenance = () => {
558
560
>
559
561
{ `${
560
562
maintenanceWindowId === undefined
561
- ? "Create maintenance"
562
- : "Edit maintenance"
563
+ ? t ( "createMaintenance" )
564
+ : t ( "editMaintenance" )
563
565
} `}
564
566
</ Button >
565
567
</ Box >
0 commit comments