mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
fix(metrics): localize 'Unknown' label in tables
This commit is contained in:
parent
06f24b0c90
commit
306b555b96
@ -10,7 +10,11 @@ export default function CountriesTable({ websiteId, onDataLoad, ...props }) {
|
|||||||
const countryNames = useCountryNames(locale);
|
const countryNames = useCountryNames(locale);
|
||||||
|
|
||||||
function renderLabel({ x }) {
|
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 (
|
return (
|
||||||
|
@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|||||||
import { FixedSizeList } from 'react-window';
|
import { FixedSizeList } from 'react-window';
|
||||||
import { useSpring, animated, config } from 'react-spring';
|
import { useSpring, animated, config } from 'react-spring';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { FormattedMessage } from 'react-intl';
|
||||||
import NoData from 'components/common/NoData';
|
import NoData from 'components/common/NoData';
|
||||||
import { formatNumber, formatLongNumber } from 'lib/format';
|
import { formatNumber, formatLongNumber } from 'lib/format';
|
||||||
import styles from './DataTable.module.css';
|
import styles from './DataTable.module.css';
|
||||||
@ -27,7 +28,11 @@ export default function DataTable({
|
|||||||
return (
|
return (
|
||||||
<AnimatedRow
|
<AnimatedRow
|
||||||
key={label}
|
key={label}
|
||||||
label={renderLabel ? renderLabel(row) : label ?? 'Unknown'}
|
label={
|
||||||
|
renderLabel
|
||||||
|
? renderLabel(row)
|
||||||
|
: label ?? <FormattedMessage id="label.unknown" defaultMessage="Unknown" />
|
||||||
|
}
|
||||||
value={value}
|
value={value}
|
||||||
percent={percent}
|
percent={percent}
|
||||||
animate={animate && !virtualize}
|
animate={animate && !virtualize}
|
||||||
|
Loading…
Reference in New Issue
Block a user