mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
i18n country names
This commit is contained in:
parent
e9f657492d
commit
adff1d7400
11 changed files with 47 additions and 83 deletions
|
|
@ -2,17 +2,15 @@ import MetricsTable, { MetricsTableProps } from './MetricsTable';
|
|||
import { emptyFilter } from 'lib/filters';
|
||||
import FilterLink from 'components/common/FilterLink';
|
||||
import TypeIcon from 'components/common/TypeIcon';
|
||||
import { useLocale } from 'components/hooks';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { useMessages } from 'components/hooks';
|
||||
import { useCountryNames } from 'components/hooks';
|
||||
|
||||
export function CitiesTable(props: MetricsTableProps) {
|
||||
const { locale } = useLocale();
|
||||
const intl = useIntl();
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { countryNames } = useCountryNames(locale);
|
||||
|
||||
const renderLabel = (city: string, country: string) => {
|
||||
const countryName = countryNames[country];
|
||||
const countryName = intl.formatDisplayName(country, { type: 'region' });
|
||||
return countryName ? `${city}, ${countryName}` : city;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue