i18n
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
|
||||
import { storedLocation } from '$lib/stores/settings';
|
||||
|
||||
import { routePath } from '$lib/i18n';
|
||||
import * as m from '$lib/paraglide/messages';
|
||||
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
@@ -29,15 +32,15 @@
|
||||
// load resolves (and any weather page that doesn't carry a location).
|
||||
let location = $derived($page.data.location ?? $storedLocation);
|
||||
|
||||
const SUBTITLES: [string, string][] = [
|
||||
['/weather/week', '7-day forecast'],
|
||||
['/weather/compare', 'Model comparison'],
|
||||
['/weather/14-day', '14-day ensemble forecast'],
|
||||
['/weather/seasonal', 'Seasonal outlook'],
|
||||
['/weather/historical', 'Historical weather']
|
||||
const SUBTITLES: [string, () => string][] = [
|
||||
['/weather/week', m.page_week_subtitle],
|
||||
['/weather/compare', m.page_compare_subtitle],
|
||||
['/weather/14-day', m.page_14day_subtitle],
|
||||
['/weather/seasonal', m.page_seasonal_subtitle],
|
||||
['/weather/historical', m.page_historical_subtitle]
|
||||
];
|
||||
let subtitle = $derived(
|
||||
SUBTITLES.find(([prefix]) => $page.url.pathname.startsWith(prefix))?.[1] ?? null
|
||||
SUBTITLES.find(([prefix]) => routePath($page.url.pathname).startsWith(prefix))?.[1]?.() ?? null
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user