mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-08-03 09:31:52 +00:00
Pass locale to chart rendering library
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
"semantic-ui-css": "^2.4.1",
|
"semantic-ui-css": "^2.4.1",
|
||||||
"semantic-ui-react": "^0.84.0",
|
"semantic-ui-react": "^0.84.0",
|
||||||
"string.prototype.startswith": "^0.2.0",
|
"string.prototype.startswith": "^0.2.0",
|
||||||
"topola": "2.x"
|
"topola": "^2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/d3": "^5.5.0",
|
"@types/d3": "^5.5.0",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as d3 from 'd3';
|
import * as d3 from 'd3';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import {intlShape} from 'react-intl';
|
||||||
import {
|
import {
|
||||||
JsonGedcomData,
|
JsonGedcomData,
|
||||||
ChartHandle,
|
ChartHandle,
|
||||||
@@ -52,6 +53,7 @@ export class Chart extends React.PureComponent<ChartProps, {}> {
|
|||||||
indiCallback: (info) => this.props.onSelection(info),
|
indiCallback: (info) => this.props.onSelection(info),
|
||||||
animate: true,
|
animate: true,
|
||||||
updateSvgSize: false,
|
updateSvgSize: false,
|
||||||
|
locale: this.context.intl.locale,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const chartInfo = this.chart!.render({
|
const chartInfo = this.chart!.render({
|
||||||
@@ -119,6 +121,11 @@ export class Chart extends React.PureComponent<ChartProps, {}> {
|
|||||||
this.renderChart({initialRender: this.props.data !== prevProps.data});
|
this.renderChart({initialRender: this.props.data !== prevProps.data});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Make intl appear in this.context. */
|
||||||
|
static contextTypes = {
|
||||||
|
intl: intlShape,
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div id="svgContainer">
|
<div id="svgContainer">
|
||||||
|
|||||||
Reference in New Issue
Block a user