File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "dependencies" : {
3+ "@types/react" : " ^18.0.25" ,
4+ "i18next" : " ^22.0.6" ,
5+ "i18next-browser-languagedetector" : " ^7.0.1" ,
6+ "react-i18next" : " ^12.0.0"
7+ }
8+ }
Original file line number Diff line number Diff line change 5959 "redux" : " ^4.0.1" ,
6060 "redux-logger" : " ^3.0.6" ,
6161 "redux-saga" : " ^1.0.2" ,
62- "webpack-merge" : " ^4.2.1"
62+ "webpack-merge" : " ^4.2.1" ,
63+ "i18next" : " ^22.0.6" ,
64+ "i18next-browser-languagedetector" : " ^7.0.1" ,
65+ "react-i18next" : " ^12.0.0"
6366 },
6467 "devDependencies" : {
6568 "@types/classnames" : " ^2.2.10" ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import MqText from '../core/text/MqText'
1010import NamespaceSelect from '../namespace-select/NamespaceSelect'
1111import React , { ReactElement } from 'react'
1212import Search from '../search/Search'
13+ import { useTranslation } from 'react-i18next' ;
1314
1415const styles = ( theme : Theme ) => {
1516 return createStyles ( {
@@ -40,6 +41,7 @@ const styles = (theme: Theme) => {
4041type HeaderProps = WithStyles < typeof styles >
4142
4243const Header = ( props : HeaderProps ) : ReactElement => {
44+ const { t } = useTranslation ( ) ;
4345 const { classes } = props
4446 return (
4547 < AppBar position = 'fixed' elevation = { 0 } className = { classes . appBar } >
@@ -53,7 +55,7 @@ const Header = (props: HeaderProps): ReactElement => {
5355 < NamespaceSelect />
5456 < Box ml = { 2 } >
5557 < MqText link href = { API_DOCS_URL } >
56- API Docs
58+ { t ( 'header' ) }
5759 </ MqText >
5860 </ Box >
5961 </ Box >
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import MqText from '../core/text/MqText'
2424import RunInfo from './RunInfo'
2525import RunStatus from './RunStatus'
2626import Runs from './Runs'
27+ import { useTranslation } from 'react-i18next' ;
2728
2829const styles = ( { spacing } : ITheme ) => {
2930 return createStyles ( {
@@ -52,6 +53,7 @@ const JobDetailPage: FunctionComponent<IProps> = props => {
5253 const handleChange = ( event : ChangeEvent , newValue : SetStateAction < number > ) => {
5354 setTab ( newValue )
5455 }
56+ const { t } = useTranslation ( ) ;
5557
5658 useEffect ( ( ) => {
5759 fetchRuns ( job . name , job . namespace )
@@ -82,8 +84,8 @@ const JobDetailPage: FunctionComponent<IProps> = props => {
8284 >
8385 < Box mb = { 2 } display = { 'flex' } justifyContent = { 'space-between' } alignItems = { 'center' } >
8486 < Tabs value = { tab } onChange = { handleChange } textColor = 'primary' indicatorColor = 'primary' >
85- < Tab label = 'LATEST RUN' disableRipple = { true } />
86- < Tab label = 'RUN HISTORY' disableRipple = { true } />
87+ < Tab label = { t ( 'JobTab1' ) } disableRipple = { true } />
88+ < Tab label = { t ( 'JobTab2' ) } disableRipple = { true } />
8789 </ Tabs >
8890 < Box display = { 'flex' } alignItems = { 'center' } >
8991 < Box mr = { 1 } >
Original file line number Diff line number Diff line change 1+ import i18n from 'i18next' ;
2+ import { initReactI18next } from 'react-i18next' ;
3+ import LanguageDetector from 'i18next-browser-languagedetector' ;
4+
5+ i18n
6+ // detect user language
7+ // learn more: https://github.com/i18next/i18next-browser-languageDetector
8+ . use ( LanguageDetector )
9+ // pass the i18n instance to react-i18next.
10+ . use ( initReactI18next )
11+ // init i18next
12+ // for all options read: https://www.i18next.com/overview/configuration-options
13+ . init ( {
14+ debug : true ,
15+ fallbackLng : 'en' ,
16+ interpolation : {
17+ escapeValue : false , // not needed for react as it escapes by default
18+ } ,
19+ resources : {
20+ en : {
21+ translation : {
22+ // here we will place our translations...
23+ header : 'API Docs' ,
24+ JobTab1 : 'LATEST RUN' ,
25+ JobTab2 : 'RUN HISTORY'
26+ }
27+ } ,
28+ fr : {
29+ translation : {
30+ header : 'API Docs' ,
31+ JobTab1 : 'DERNIÈRE COURSE' ,
32+ JobTab2 : "HISTORIQUE D'EXECUTION"
33+ }
34+ } ,
35+ sp : {
36+ translation : {
37+ header : 'API Docs' ,
38+ JobTab1 : 'ÚLTIMA EJECUCIÓN' ,
39+ JobTab2 : 'HISTORIAL DE EJECUCIONES'
40+ }
41+ }
42+
43+ }
44+ } ) ;
45+
46+ export default i18n ;
Original file line number Diff line number Diff line change @@ -5,4 +5,7 @@ import App from './components/App'
55// fonts
66import './index.css'
77
8+ // i18n
9+ import './i18n.js' ;
10+
811ReactDOM . render ( < App /> , document . getElementById ( 'root' ) )
You can’t perform that action at this time.
0 commit comments