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