last translations
This commit is contained in:
@@ -541,6 +541,8 @@
|
||||
<NearbyCities
|
||||
latitude={location.latitude}
|
||||
longitude={location.longitude}
|
||||
population={location.population}
|
||||
countryCode={location.country_code}
|
||||
{selectedDayKey}
|
||||
units={$storedUnits}
|
||||
/>
|
||||
|
||||
@@ -24,6 +24,16 @@
|
||||
groups.flatMap((group) => group.models).find((mo) => mo.value === selectedModel)
|
||||
);
|
||||
let modelLabel = $derived(model?.label ?? selectedModel);
|
||||
// Provider groups are brand names and stay as they are; the few descriptive
|
||||
// ones are the only headings that need translating.
|
||||
const GROUP_LABELS: Record<string, () => string> = {
|
||||
auto: m.model_group_automatic,
|
||||
era5: m.model_group_reanalysis,
|
||||
regional: m.model_group_regional_reanalysis
|
||||
};
|
||||
const groupLabel = (group: { value: string; label: string }) =>
|
||||
GROUP_LABELS[group.value]?.() ?? group.label;
|
||||
|
||||
// The catalogue stores update cadences as English shorthand ("every 6 h");
|
||||
// map the handful of forms onto messages instead of translating the data.
|
||||
function updateLabel(update: string): string {
|
||||
@@ -99,7 +109,7 @@
|
||||
<Select.GroupHeading
|
||||
class="text-[10.5px] font-bold tracking-wider text-primary/80 uppercase"
|
||||
>
|
||||
{group.label}
|
||||
{groupLabel(group)}
|
||||
</Select.GroupHeading>
|
||||
{#each group.models as mo (mo.value)}
|
||||
<Select.Item class="cursor-pointer" value={mo.value} label={mo.label}>
|
||||
|
||||
@@ -16,12 +16,16 @@
|
||||
interface Props {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
/** of the location itself: sets how far out counts as "still here" */
|
||||
population: number | undefined;
|
||||
/** of the location itself: only foreign countries are worth naming */
|
||||
countryCode: string | undefined;
|
||||
/** "yyyy-MM-dd" of the day the rest of the page is showing */
|
||||
selectedDayKey: string;
|
||||
units: UnitPrefs;
|
||||
}
|
||||
|
||||
let { latitude, longitude, selectedDayKey, units }: Props = $props();
|
||||
let { latitude, longitude, population, countryCode, selectedDayKey, units }: Props = $props();
|
||||
|
||||
const COUNT = 10;
|
||||
|
||||
@@ -45,6 +49,7 @@
|
||||
$effect(() => {
|
||||
const lat = latitude;
|
||||
const lon = longitude;
|
||||
const pop = population ?? 0;
|
||||
const unitPrefs = { ...units };
|
||||
let cancelled = false;
|
||||
|
||||
@@ -54,7 +59,7 @@
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const found = await findNearbyCities(lat, lon, COUNT);
|
||||
const found = await findNearbyCities(lat, lon, COUNT, pop);
|
||||
if (cancelled) return;
|
||||
cities = found;
|
||||
|
||||
@@ -118,8 +123,11 @@
|
||||
</svg>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="truncate text-sm font-medium group-hover:underline">{city.name}</div>
|
||||
<div class="text-[11px] text-muted-foreground">
|
||||
{distance(city.distanceKm)} · {countryName(city.countryCode)}
|
||||
<div class="truncate text-[11px] text-muted-foreground">
|
||||
<!-- the country only earns its space when it isn't the one you are in -->
|
||||
{distance(city.distanceKm)}{city.countryCode === countryCode
|
||||
? ''
|
||||
: ` · ${countryName(city.countryCode)}`}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right text-sm tabular-nums">
|
||||
|
||||
Reference in New Issue
Block a user