openwrt-firmware-selector/src/App.js
Sudhanshu Gautam 07b13c3f7a adds translation support via i18n.js
Uses react-i18next library to provide APIs for translational
purposes.
Translation data is loaded from `src/locales/{{lng}}/translation.json`
and is accessed by dot notation.
The data can be translated in two ways:
1. In functional components, a method `t` can be instantiated using the
`useTranslation` method from rect-18next.
2. In class components, a method `t` can be accessed via props while
exporting the component with `withTranslation` method from react-i18next
library.

The syntax will look like `t('data.data')` or `this.props.t('data.data')`

Signed-off-by: Sudhanshu Gautam <me@sudhanshug.com>
2019-06-29 12:22:32 +05:30

43 lines
1 KiB
JavaScript

import React, { Suspense } from 'react';
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import './App.scss';
import { createMuiTheme } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import Header from './components/header.js'
import Home from './containers/home/home';
import NotFound from './containers/not-found/not-found';
import LinearProgress from '@material-ui/core/LinearProgress';
const theme = createMuiTheme({
palette: {
primary: {
main: '#3F51B5',
},
secondary: {
main: '#009688',
},
},
});
function App() {
return (
<ThemeProvider theme={theme}>
<Suspense fallback={
<LinearProgress />
}>
<div className="App">
<Header></Header>
<Router>
<Switch>
<Route path="" component={Home}></Route>
<Route default component={NotFound}></Route>
</Switch>
</Router>
</div>
</Suspense>
</ThemeProvider>
);
}
export default App;