Skip to content

Commit

Permalink
fix(metrics): localize 'Unknown' label in tables
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarlex committed Feb 20, 2021
1 parent 06f24b0 commit 306b555
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion components/metrics/CountriesTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export default function CountriesTable({ websiteId, onDataLoad, ...props }) {
const countryNames = useCountryNames(locale);

function renderLabel({ x }) {
return <div className={locale}>{countryNames[x] ?? 'Unknown'}</div>;
return (
<div className={locale}>
{countryNames[x] ?? <FormattedMessage id="label.unknown" defaultMessage="Unknown" />}
</div>
);
}

return (
Expand Down
7 changes: 6 additions & 1 deletion components/metrics/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { FixedSizeList } from 'react-window';
import { useSpring, animated, config } from 'react-spring';
import classNames from 'classnames';
import { FormattedMessage } from 'react-intl';
import NoData from 'components/common/NoData';
import { formatNumber, formatLongNumber } from 'lib/format';
import styles from './DataTable.module.css';
Expand All @@ -27,7 +28,11 @@ export default function DataTable({
return (
<AnimatedRow
key={label}
label={renderLabel ? renderLabel(row) : label ?? 'Unknown'}
label={
renderLabel
? renderLabel(row)
: label ?? <FormattedMessage id="label.unknown" defaultMessage="Unknown" />
}
value={value}
percent={percent}
animate={animate && !virtualize}
Expand Down

0 comments on commit 306b555

Please sign in to comment.