1616
1717import { createDevApp } from '@backstage/dev-utils' ;
1818import { quickstartPlugin , QuickstartDrawerProvider } from '../src/plugin' ;
19+ import { quickstartTranslations } from '../src/translations' ;
1920import { useQuickstartDrawerContext } from '../src/hooks/useQuickstartDrawerContext' ;
21+ import { useTranslation } from '../src/hooks/useTranslation' ;
2022import Box from '@mui/material/Box' ;
2123import Typography from '@mui/material/Typography' ;
2224import Card from '@mui/material/Card' ;
@@ -27,26 +29,28 @@ import { getAllThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
2729const QuickstartTestPageContent = ( ) => {
2830 const { openDrawer, closeDrawer, isDrawerOpen } =
2931 useQuickstartDrawerContext ( ) ;
32+ const { t } = useTranslation ( ) ;
3033
3134 return (
3235 < Box sx = { { padding : 4 } } >
3336 < Typography variant = "h3" gutterBottom >
34- Quickstart Plugin Test Page
37+ { t ( 'dev.pageTitle' ) }
3538 </ Typography >
3639
3740 < Typography variant = "body1" paragraph >
38- This is a test page for the Quickstart plugin. Use the buttons below to
39- interact with the quickstart drawer.
41+ { t ( 'dev.pageDescription' ) }
4042 </ Typography >
4143
4244 < Card sx = { { maxWidth : 600 , marginBottom : 2 } } >
4345 < CardContent >
4446 < Typography variant = "h6" gutterBottom >
45- Drawer Controls
47+ { t ( 'dev.drawerControls' ) }
4648 </ Typography >
4749
4850 < Typography variant = "body2" color = "text.secondary" paragraph >
49- Current drawer state: { isDrawerOpen ? 'Open' : 'Closed' }
51+ { t ( 'dev.currentState' as any , {
52+ state : isDrawerOpen ? t ( 'dev.stateOpen' ) : t ( 'dev.stateClosed' ) ,
53+ } ) }
5054 </ Typography >
5155
5256 < Box sx = { { display : 'flex' , gap : 2 } } >
@@ -56,15 +60,15 @@ const QuickstartTestPageContent = () => {
5660 onClick = { openDrawer }
5761 disabled = { isDrawerOpen }
5862 >
59- Open Quickstart Guide
63+ { t ( 'button.openQuickstartGuide' ) }
6064 </ Button >
6165
6266 < Button
6367 variant = "outlined"
6468 onClick = { closeDrawer }
6569 disabled = { ! isDrawerOpen }
6670 >
67- Close Drawer
71+ { t ( 'button.closeDrawer' ) }
6872 </ Button >
6973 </ Box >
7074 </ CardContent >
@@ -73,19 +77,18 @@ const QuickstartTestPageContent = () => {
7377 < Card sx = { { maxWidth : 600 } } >
7478 < CardContent >
7579 < Typography variant = "h6" gutterBottom >
76- Instructions
80+ { t ( 'dev.instructions' ) }
7781 </ Typography >
7882 < Typography variant = "body2" color = "text.secondary" >
79- 1. Click "Open Quickstart Guide" to open the drawer
83+ { t ( 'dev.step1' ) }
8084 < br />
81- 2. Navigate through the quickstart steps
85+ { t ( 'dev.step2' ) }
8286 < br />
83- 3. Test the progress tracking by completing steps
87+ { t ( 'dev.step3' ) }
8488 < br />
85- 4. The drawer can be closed using the close button or the drawer's
86- own controls
89+ { t ( 'dev.step4' ) }
8790 < br />
88- 5. Progress is automatically saved to localStorage
91+ { t ( 'dev.step5' ) }
8992 </ Typography >
9093 </ CardContent >
9194 </ Card >
@@ -101,6 +104,9 @@ const QuickstartTestPage = () => (
101104
102105createDevApp ( )
103106 . registerPlugin ( quickstartPlugin )
107+ . addTranslationResource ( quickstartTranslations )
108+ . setAvailableLanguages ( [ 'en' , 'de' , 'fr' , 'es' ] )
109+ . setDefaultLanguage ( 'en' )
104110 . addThemes ( getAllThemes ( ) )
105111 . addPage ( {
106112 element : < QuickstartTestPage /> ,
0 commit comments