Translate pages

This commit is contained in:
Andras Schmelczer 2026-04-04 09:47:18 +01:00
parent a7aaf5effa
commit 96402228e3
49 changed files with 1458 additions and 926 deletions

View file

@ -1,4 +1,6 @@
import { useTranslation } from 'react-i18next';
import { formatValue } from '../../lib/format';
import { ts } from '../../i18n/server';
import {
FEATURE_GRADIENT,
DENSITY_GRADIENT,
@ -20,7 +22,7 @@ function EnumSwatches({ values }: { values: string[] }) {
className="w-3 h-3 rounded-sm shrink-0"
style={{ backgroundColor: `rgb(${color[0]},${color[1]},${color[2]})` }}
/>
<span className="text-warm-600 dark:text-warm-300 truncate">{label}</span>
<span className="text-warm-600 dark:text-warm-300 truncate">{ts(label)}</span>
</div>
);
})}
@ -40,7 +42,7 @@ function InlineEnumSwatches({ values }: { values: string[] }) {
style={{ backgroundColor: `rgb(${color[0]},${color[1]},${color[2]})` }}
/>
<span className="text-warm-500 dark:text-warm-400 whitespace-nowrap text-[11px]">
{label}
{ts(label)}
</span>
</div>
);
@ -60,6 +62,7 @@ export default function MapLegend({
inline = false,
suffix,
raw,
totalCount,
}: {
featureLabel: string;
range: [number, number];
@ -71,7 +74,9 @@ export default function MapLegend({
inline?: boolean;
suffix?: string;
raw?: boolean;
totalCount?: number;
}) {
const { t } = useTranslation();
const isEnum = enumValues && enumValues.length > 0;
const densityGradient = theme === 'dark' ? DENSITY_GRADIENT_DARK : DENSITY_GRADIENT;
const gradientStyle =
@ -103,7 +108,7 @@ export default function MapLegend({
<button
onClick={onCancel}
className="text-warm-400 hover:text-warm-700 dark:hover:text-warm-300 shrink-0"
title="Clear colour view"
title={t('mapLegend.clearColourView')}
>
<CloseIcon className="w-3.5 h-3.5" />
</button>
@ -132,7 +137,7 @@ export default function MapLegend({
<button
onClick={onCancel}
className="text-warm-400 hover:text-warm-700 dark:hover:text-warm-300 ml-2"
title="Clear colour view"
title={t('mapLegend.clearColourView')}
>
<CloseIcon className="w-4 h-4" />
</button>
@ -149,6 +154,14 @@ export default function MapLegend({
</div>
</>
)}
{totalCount != null && (
<div className="mt-2 pt-2 border-t border-warm-200 dark:border-warm-700 text-warm-600 dark:text-warm-300 flex items-center justify-between">
<span>{t('common.total')}</span>
<span className="font-semibold text-navy-950 dark:text-warm-100">
<TickerValue text={formatValue(totalCount)} />
</span>
</div>
)}
</div>
);
}