mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-28 22:51:51 +00:00
Added translation support with react-imp. Added partial Polish translation.
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
import * as locale_en from 'react-intl/locale-data/en';
|
||||
import * as locale_pl from 'react-intl/locale-data/pl';
|
||||
import * as messages_pl from './translations/pl.json';
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import {addLocaleData} from 'react-intl';
|
||||
import {ChartView} from './chart_view';
|
||||
import {HashRouter as Router, Route, Switch} from 'react-router-dom';
|
||||
import {IntlProvider} from 'react-intl';
|
||||
import {Intro} from './intro';
|
||||
import {TopBar} from './top_bar';
|
||||
import 'semantic-ui-css/semantic.min.css';
|
||||
import './index.css';
|
||||
import 'semantic-ui-css/semantic.min.css';
|
||||
|
||||
addLocaleData([...locale_en, ...locale_pl]);
|
||||
|
||||
const messages = {
|
||||
pl: messages_pl,
|
||||
};
|
||||
const language = navigator.language && navigator.language.split(/[-_]/)[0];
|
||||
|
||||
ReactDOM.render(
|
||||
<Router>
|
||||
<div className="root">
|
||||
<Route component={TopBar} />
|
||||
<Switch>
|
||||
<Route exact path="/" component={Intro} />
|
||||
<Route exact path="/view" component={ChartView} />
|
||||
</Switch>
|
||||
</div>
|
||||
</Router>,
|
||||
<IntlProvider locale={language} messages={messages[language]}>
|
||||
<Router>
|
||||
<div className="root">
|
||||
<Route component={TopBar} />
|
||||
<Switch>
|
||||
<Route exact path="/" component={Intro} />
|
||||
<Route exact path="/view" component={ChartView} />
|
||||
</Switch>
|
||||
</div>
|
||||
</Router>
|
||||
</IntlProvider>,
|
||||
document.querySelector('#root'),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user