@sarimarcus/content-sites-ui 0.54.1 → 0.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/src/affiliate/AffiliateCard.astro +10 -8
- package/src/affiliate/AffiliateCardSection.astro +5 -2
- package/src/affiliate/AffiliateCarousel.astro +6 -2
- package/src/affiliate/AffiliateComparisonTable.astro +14 -11
- package/src/affiliate/AmazonProductCard.astro +3 -2
- package/src/affiliate/AmazonProductSection.astro +5 -3
- package/src/affiliate/HotelAffiliateCTA.astro +15 -12
- package/src/affiliate/InlineAffiliateCTA.astro +3 -2
- package/src/affiliate/StickyCTA.astro +7 -4
- package/src/affiliate/TravelpayoutsWidget.astro +3 -2
- package/src/affiliate/cardItem.ts +1 -1
- package/src/composed/CardCarousel.astro +8 -5
- package/src/composed/FAQ.astro +3 -2
- package/src/composed/Pagination.astro +9 -6
- package/src/composed/TableOfContents.astro +7 -4
- package/src/editorial/AlsoExplore.astro +3 -2
- package/src/editorial/ArticleCategoryNav.astro +6 -3
- package/src/editorial/ArticleFeatureCard.astro +5 -2
- package/src/editorial/ArticleTopicPager.astro +9 -6
- package/src/editorial/ChronologyTimeline.astro +12 -7
- package/src/editorial/DossierSection.astro +7 -4
- package/src/editorial/EraChip.astro +5 -2
- package/src/editorial/EraDossiers.astro +3 -2
- package/src/editorial/EraPeopleRow.astro +10 -6
- package/src/editorial/EraScenes.astro +9 -6
- package/src/editorial/EraTimelineNav.astro +3 -2
- package/src/editorial/EventEditionBadge.astro +6 -4
- package/src/editorial/EventEditionBanner.astro +8 -5
- package/src/editorial/EventPage.astro +1 -1
- package/src/editorial/NotFoundPage.astro +5 -2
- package/src/editorial/PeopleBand.astro +5 -3
- package/src/editorial/PeopleChips.astro +4 -3
- package/src/editorial/PeopleHub.astro +11 -5
- package/src/editorial/PeopleTimeline.astro +7 -4
- package/src/editorial/PersonCard.astro +3 -2
- package/src/editorial/PersonChip.astro +3 -2
- package/src/editorial/PersonPage.astro +22 -17
- package/src/editorial/VisitTiming.astro +6 -3
- package/src/editorial/chronology-page.ts +4 -2
- package/src/editorial/era-listing.ts +3 -2
- package/src/editorial/eventEdition.ts +3 -2
- package/src/editorial/person-page.ts +5 -3
- package/src/internal/labels.ts +194 -0
- package/src/layout/DocumentShell.astro +7 -2
- package/src/navigation/ArticlesNavMenu.astro +4 -3
- package/src/navigation/SiteFooter.astro +7 -4
- package/src/navigation/SiteHeader.astro +7 -4
- package/src/navigation/types.ts +2 -0
- package/src/seo/ArticleMetadata.astro +9 -7
- package/src/seo/AuthoritativeSources.astro +20 -12
- package/src/seo/Breadcrumb.astro +6 -3
- package/src/seo/schemaContext.ts +2 -1
- package/src/seo/sourceLabels.ts +1 -0
- package/src/seo/types.ts +1 -1
|
@@ -38,7 +38,7 @@ import { monogram as initialsOf } from './monogram';
|
|
|
38
38
|
import PersonSection from './PersonSection.astro';
|
|
39
39
|
import CardPlaceholder from './CardPlaceholder.astro';
|
|
40
40
|
import QuickFacts from '../composed/QuickFacts.astro';
|
|
41
|
-
import {
|
|
41
|
+
import { getLabels } from '../internal/labels';
|
|
42
42
|
|
|
43
43
|
type PersonImage =
|
|
44
44
|
| { image?: undefined; fallbackSrc?: undefined; imageAlt?: string }
|
|
@@ -99,9 +99,12 @@ type Props = PersonImage & {
|
|
|
99
99
|
timeline?: { eras: readonly EraDefinition[]; items: Record<string, readonly TimelineItem[]>; heading?: string };
|
|
100
100
|
/** Overrides of the ToC pill labels. */
|
|
101
101
|
tocLabels?: Partial<Record<'biography' | 'places' | 'timeline' | 'readMore', string>>;
|
|
102
|
+
locale?: string;
|
|
102
103
|
pagefindType?: string;
|
|
103
104
|
};
|
|
104
105
|
|
|
106
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).personPage;
|
|
107
|
+
|
|
105
108
|
const {
|
|
106
109
|
name,
|
|
107
110
|
dates,
|
|
@@ -110,7 +113,7 @@ const {
|
|
|
110
113
|
circa = false,
|
|
111
114
|
lifespan,
|
|
112
115
|
aliases = [],
|
|
113
|
-
aliasesLabel =
|
|
116
|
+
aliasesLabel = defaultLabels.alsoKnownAs,
|
|
114
117
|
contextFact,
|
|
115
118
|
monogram,
|
|
116
119
|
roles = [],
|
|
@@ -122,26 +125,27 @@ const {
|
|
|
122
125
|
bioHtml,
|
|
123
126
|
proseClass = 'prose-lg',
|
|
124
127
|
fullStory,
|
|
125
|
-
fullStoryHeading =
|
|
128
|
+
fullStoryHeading = defaultLabels.fullStoryHeading,
|
|
126
129
|
places = [],
|
|
127
|
-
placesHeading =
|
|
130
|
+
placesHeading = defaultLabels.placesHeading,
|
|
128
131
|
readMore = [],
|
|
129
132
|
readMoreLimit = 4,
|
|
130
|
-
readMoreHeading =
|
|
133
|
+
readMoreHeading = defaultLabels.readMoreHeading,
|
|
131
134
|
timeline,
|
|
132
135
|
tocLabels,
|
|
136
|
+
locale,
|
|
133
137
|
pagefindType = 'person',
|
|
134
138
|
} = Astro.props;
|
|
135
139
|
|
|
136
|
-
const timelineHeading = timeline?.heading ??
|
|
140
|
+
const timelineHeading = timeline?.heading ?? defaultLabels.timelineHeading;
|
|
137
141
|
const hasTimeline = Boolean(timeline && Object.values(timeline.items).some((list) => list.length > 0));
|
|
138
142
|
const readMoreItems = readMore.slice(0, readMoreLimit);
|
|
139
143
|
|
|
140
144
|
const span = lifeSpan({ birthYear, deathYear });
|
|
141
145
|
const lifespanByKind = {
|
|
142
|
-
range: () =>
|
|
143
|
-
born: () =>
|
|
144
|
-
died: () =>
|
|
146
|
+
range: () => defaultLabels.lifespan(span.years ?? '', circa, span.age),
|
|
147
|
+
born: () => defaultLabels.born(span.years ?? '', circa),
|
|
148
|
+
died: () => defaultLabels.died(span.years ?? '', circa),
|
|
145
149
|
none: () => undefined,
|
|
146
150
|
};
|
|
147
151
|
const derivedLifespan = lifespanByKind[span.kind]();
|
|
@@ -155,10 +159,10 @@ const facts = [
|
|
|
155
159
|
const hasFullStoryCard = Boolean(fullStory?.title);
|
|
156
160
|
const bioParagraphs = (String(bioHtml).match(/<p[\s>]/g) ?? []).length;
|
|
157
161
|
const toc = {
|
|
158
|
-
biography: tocLabels?.biography ??
|
|
159
|
-
places: tocLabels?.places ??
|
|
160
|
-
timeline: tocLabels?.timeline ??
|
|
161
|
-
readMore: tocLabels?.readMore ??
|
|
162
|
+
biography: tocLabels?.biography ?? defaultLabels.tocLabels.biography,
|
|
163
|
+
places: tocLabels?.places ?? defaultLabels.tocLabels.places,
|
|
164
|
+
timeline: tocLabels?.timeline ?? defaultLabels.tocLabels.timeline,
|
|
165
|
+
readMore: tocLabels?.readMore ?? defaultLabels.tocLabels.readMore,
|
|
162
166
|
};
|
|
163
167
|
const showToc = bioParagraphs > 4;
|
|
164
168
|
const tocItems = [
|
|
@@ -190,7 +194,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
190
194
|
{roles.map((role) => (
|
|
191
195
|
<RoleBadge onImage>{role}</RoleBadge>
|
|
192
196
|
))}
|
|
193
|
-
<EraChip era={era} basePath={eraBasePath} onImage />
|
|
197
|
+
<EraChip era={era} basePath={eraBasePath} onImage locale={locale} />
|
|
194
198
|
</Fragment>
|
|
195
199
|
<Fragment slot="subtitle">
|
|
196
200
|
{lifespanText && (
|
|
@@ -211,6 +215,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
211
215
|
items={tocItems}
|
|
212
216
|
sectionSelector="[data-person-section]"
|
|
213
217
|
hideMiniPastLastSection
|
|
218
|
+
locale={locale}
|
|
214
219
|
/>
|
|
215
220
|
)}
|
|
216
221
|
|
|
@@ -226,7 +231,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
226
231
|
|
|
227
232
|
{fullStory && !hasFullStoryCard && (
|
|
228
233
|
<p class="mt-6">
|
|
229
|
-
<LinkArrow href={fullStory.href} size="base">{fullStory.label ??
|
|
234
|
+
<LinkArrow href={fullStory.href} size="base">{fullStory.label ?? defaultLabels.readFullStory}</LinkArrow>
|
|
230
235
|
</p>
|
|
231
236
|
)}
|
|
232
237
|
|
|
@@ -245,7 +250,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
245
250
|
<CardPlaceholder slot="fallback"><Icon name="book-open" class="size-10 text-primary/70" /></CardPlaceholder>
|
|
246
251
|
<h3 class="text-xl font-display font-semibold text-foreground">{fullStory.title}</h3>
|
|
247
252
|
{fullStory.summary && <p class="mt-2 text-sm leading-relaxed text-muted-foreground">{fullStory.summary}</p>}
|
|
248
|
-
<ArrowLabel slot="footer-cta" class="text-sm font-medium text-primary">{fullStory.label ??
|
|
253
|
+
<ArrowLabel slot="footer-cta" class="text-sm font-medium text-primary">{fullStory.label ?? defaultLabels.readFullStory}</ArrowLabel>
|
|
249
254
|
</EntityCard>
|
|
250
255
|
</div>
|
|
251
256
|
</PersonSection>
|
|
@@ -262,7 +267,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
262
267
|
{timeline && hasTimeline && (
|
|
263
268
|
<Container size="content" class="mt-16">
|
|
264
269
|
<PersonSection section="timeline" heading={timelineHeading} headingClass="mb-8">
|
|
265
|
-
<ChronologyTimeline eras={timeline.eras} items={timeline.items} index={false} />
|
|
270
|
+
<ChronologyTimeline eras={timeline.eras} items={timeline.items} index={false} locale={locale} />
|
|
266
271
|
</PersonSection>
|
|
267
272
|
</Container>
|
|
268
273
|
)}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* default top margin (`mt-12`); `labelClass` sets the slot label size.
|
|
5
5
|
*/
|
|
6
6
|
import Icon from '../primitives/Icon.astro';
|
|
7
|
-
import {
|
|
7
|
+
import { getLabels } from '../internal/labels';
|
|
8
8
|
|
|
9
9
|
export interface VisitTimingData {
|
|
10
10
|
bestSeason?: string;
|
|
@@ -20,17 +20,20 @@ interface Props {
|
|
|
20
20
|
id?: string;
|
|
21
21
|
class?: string;
|
|
22
22
|
labelClass?: string;
|
|
23
|
+
locale?: string;
|
|
23
24
|
/** Row labels; default English. */
|
|
24
25
|
labels?: { bestSeason: string; quietestHours: string; visitDuration: string };
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).visitTiming;
|
|
29
|
+
|
|
27
30
|
const {
|
|
28
31
|
visitTiming,
|
|
29
|
-
title =
|
|
32
|
+
title = defaultLabels.title,
|
|
30
33
|
id = 'when-to-visit',
|
|
31
34
|
class: className = 'mt-12',
|
|
32
35
|
labelClass = 'text-[0.8125rem]',
|
|
33
|
-
labels =
|
|
36
|
+
labels = defaultLabels,
|
|
34
37
|
} = Astro.props;
|
|
35
38
|
|
|
36
39
|
const slots = visitTiming
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
2
2
|
import { formatYearRange } from '@sarimarcus/content-sites-core/eras';
|
|
3
3
|
import { formatLifeDates } from '@sarimarcus/content-sites-core/people';
|
|
4
|
-
import {
|
|
4
|
+
import { getLabels } from '../internal/labels';
|
|
5
5
|
import { groupByEra, type SceneItem } from './chronology';
|
|
6
6
|
|
|
7
7
|
interface Dated {
|
|
@@ -36,6 +36,7 @@ export interface ChronologyInput {
|
|
|
36
36
|
personPortrait: (slug: string) => SceneItem['image'] | undefined;
|
|
37
37
|
roleLabel: (role: string) => string;
|
|
38
38
|
personKind?: string;
|
|
39
|
+
locale?: string;
|
|
39
40
|
/** Newest-first articles kept per era. */
|
|
40
41
|
articlesPerEra?: number;
|
|
41
42
|
}
|
|
@@ -64,7 +65,8 @@ export function buildChronology({
|
|
|
64
65
|
personHref,
|
|
65
66
|
personPortrait,
|
|
66
67
|
roleLabel,
|
|
67
|
-
|
|
68
|
+
locale,
|
|
69
|
+
personKind = getLabels(locale).personRoute.personKind,
|
|
68
70
|
articlesPerEra = 5,
|
|
69
71
|
}: ChronologyInput): ChronologyModel {
|
|
70
72
|
const rows: Row[] = sources.flatMap(([type, entries]) =>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
2
2
|
import { maxDate } from '@sarimarcus/content-sites-core/dates';
|
|
3
3
|
import { toAbsoluteSiteUrl, url } from '@sarimarcus/content-sites-core/url';
|
|
4
|
-
import { LABELS } from '../internal/labels';
|
|
4
|
+
import { getLabels, type LABELS } from '../internal/labels';
|
|
5
5
|
|
|
6
6
|
interface ArticleLike {
|
|
7
7
|
data: { slug: string; title: string; description?: string; dateModified?: string; datePublished?: string };
|
|
@@ -25,13 +25,14 @@ export interface EraListingInput {
|
|
|
25
25
|
chronologyHref: string;
|
|
26
26
|
/** Title and description of page 2+ (page 1 uses `copy`). */
|
|
27
27
|
pagedMeta?: { title: string; description: string };
|
|
28
|
+
locale?: string;
|
|
28
29
|
labels?: Partial<typeof LABELS.eraListing>;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/** The head data and strings of an era listing route; `EraListingRoute` renders the body from it. */
|
|
32
33
|
export function buildEraListing(input: EraListingInput) {
|
|
33
34
|
const { era, copy, eraArticles, pageArticles, page, totalPages, siteUrl: rawSiteUrl, basePath, hubPath, articlesHref, articleHref, chronologyHref, pagedMeta } = input;
|
|
34
|
-
const L = { ...
|
|
35
|
+
const L = { ...getLabels(input.locale).eraListing, ...input.labels };
|
|
35
36
|
const first = page === 1;
|
|
36
37
|
if (!first && !pagedMeta) throw new Error(`buildEraListing: page ${page} of ${hubPath} needs pagedMeta`);
|
|
37
38
|
const siteUrl = rawSiteUrl.replace(/\/$/, '');
|
|
@@ -31,5 +31,6 @@ export function eventEdition(
|
|
|
31
31
|
export const eventEditionState = (event: { startDate?: string; endDate?: string }, today?: string): EventEditionState | null =>
|
|
32
32
|
eventEdition(event, today).state;
|
|
33
33
|
|
|
34
|
-
/** `2026-05-10` as `10 May 2026
|
|
35
|
-
export const editionDateLabel = (day: string
|
|
34
|
+
/** `2026-05-10` as `10 May 2026` (or in `locale`); '' for a malformed day. */
|
|
35
|
+
export const editionDateLabel = (day: string, locale: string = 'en-GB'): string =>
|
|
36
|
+
formatUtcDate(day, { day: 'numeric', month: 'long', year: 'numeric' }, locale);
|
|
@@ -2,7 +2,7 @@ import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
|
2
2
|
import { formatYearRange } from '@sarimarcus/content-sites-core/eras';
|
|
3
3
|
import { buildPersonBacklinks, formatLifeDates, type PersonBacklink } from '@sarimarcus/content-sites-core/people';
|
|
4
4
|
import type { RelatedItem } from '../composed/related';
|
|
5
|
-
import {
|
|
5
|
+
import { getLabels } from '../internal/labels';
|
|
6
6
|
import { groupByEra, type TimelineItem } from './chronology';
|
|
7
7
|
|
|
8
8
|
type PersonType = string;
|
|
@@ -78,6 +78,7 @@ export interface PersonModelInput<A extends { data: { slug: string; dateModified
|
|
|
78
78
|
/** The era timeline's section kinds. */
|
|
79
79
|
monumentKind?: string;
|
|
80
80
|
personKind?: string;
|
|
81
|
+
locale?: string;
|
|
81
82
|
timelineLimit?: number;
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -85,11 +86,12 @@ export interface PersonModelInput<A extends { data: { slug: string; dateModified
|
|
|
85
86
|
export function buildPersonModel<A extends { data: { slug: string; dateModified?: unknown } }, M extends { data: { era?: string; yearStart?: number; yearEnd?: number } }, Pe extends PersonEntry>(
|
|
86
87
|
input: PersonModelInput<A, M, Pe>,
|
|
87
88
|
) {
|
|
89
|
+
const defaultLabels = getLabels(input.locale).personRoute;
|
|
88
90
|
const {
|
|
89
91
|
person, links, entries, articles, monuments, people, era, toRelatedItem, toCardItem, personPortrait, personHref,
|
|
90
92
|
placeTypes = ['monument', 'museum', 'neighborhood', 'walk'],
|
|
91
|
-
monumentKind =
|
|
92
|
-
personKind =
|
|
93
|
+
monumentKind = defaultLabels.monumentKind,
|
|
94
|
+
personKind = defaultLabels.personKind,
|
|
93
95
|
timelineLimit = 5,
|
|
94
96
|
} = input;
|
|
95
97
|
const related = (link: PersonBacklink) => toRelatedItem(entries[`${link.type}:${link.slug}`] as never);
|
package/src/internal/labels.ts
CHANGED
|
@@ -183,3 +183,197 @@ export const LABELS = {
|
|
|
183
183
|
timelineLink: (era: string) => `See ${era} on the timeline, with its people and monuments`,
|
|
184
184
|
},
|
|
185
185
|
};
|
|
186
|
+
|
|
187
|
+
const eraLabelsIt = { indexLabel: 'Epoche', dossiersLabel: 'Approfondisci' };
|
|
188
|
+
|
|
189
|
+
export const LABELS_IT: typeof LABELS = {
|
|
190
|
+
affiliateCard: {
|
|
191
|
+
pricePrefix: 'Da ',
|
|
192
|
+
bestSeller: 'Più venduto',
|
|
193
|
+
topRated: 'Più apprezzato',
|
|
194
|
+
skipTheLine: 'Salta la fila',
|
|
195
|
+
cta: 'Prenota il tuo posto',
|
|
196
|
+
reviewCount: (n: string) => `(${n} recensioni)`,
|
|
197
|
+
},
|
|
198
|
+
affiliateCardSection: { title: 'Tour e attività consigliati' },
|
|
199
|
+
affiliateCarousel: { heading: 'Tour consigliati' },
|
|
200
|
+
affiliateComparisonTable: {
|
|
201
|
+
nameLabel: 'Opzione',
|
|
202
|
+
priceLabel: 'Prezzo',
|
|
203
|
+
featureLabel: 'Punto forte',
|
|
204
|
+
caption: 'Confronto delle opzioni',
|
|
205
|
+
ctaColumn: 'Prenota o vedi',
|
|
206
|
+
externalCta: 'Verifica disponibilità',
|
|
207
|
+
internalCta: 'Vedi dettagli',
|
|
208
|
+
externalAria: (cta: string, name: string) => `${cta}: ${name} (si apre in una nuova scheda)`,
|
|
209
|
+
internalAria: (cta: string, name: string) => `${cta}: ${name}`,
|
|
210
|
+
rated: (rating: number, count?: number) => `Valutato ${rating} su 5${count ? ` su ${count} recensioni` : ''}`,
|
|
211
|
+
},
|
|
212
|
+
amazonProductCard: { ctaLabel: 'Vedi su Amazon' },
|
|
213
|
+
amazonProductSection: { title: 'Letture consigliate' },
|
|
214
|
+
eventEdition: {
|
|
215
|
+
pastBadge: (date: string) => `Edizione passata · conclusa il ${date}`,
|
|
216
|
+
bannerLead: (date: string) => `Questa pagina descrive l’edizione conclusa il ${date}.`,
|
|
217
|
+
bannerTail: 'per i prossimi appuntamenti.',
|
|
218
|
+
eventsLink: 'Vedi i prossimi eventi',
|
|
219
|
+
},
|
|
220
|
+
hotelAffiliateCTA: {
|
|
221
|
+
headline: (name: string) => `Trova la tariffa migliore per ${name}`,
|
|
222
|
+
bookCta: (noun: string) => `Prenota questo ${noun}`,
|
|
223
|
+
searchCta: 'Verifica prezzi e disponibilità',
|
|
224
|
+
bookSubhead: 'Controlla disponibilità e tariffe attuali.',
|
|
225
|
+
searchSubhead: (noun: string) => `Cerca prezzi e disponibilità attuali per questo ${noun}.`,
|
|
226
|
+
from: 'da ',
|
|
227
|
+
perNight: ' / notte',
|
|
228
|
+
reviews: (n: string) => `(${n} recensioni)`,
|
|
229
|
+
ratingOn: (source: string) => `su ${source}`,
|
|
230
|
+
freeToSearch: 'Ricerca gratuita · Nessuna registrazione richiesta',
|
|
231
|
+
officialSite: (noun: string) => `Visita il sito ufficiale di questo ${noun}`,
|
|
232
|
+
},
|
|
233
|
+
inlineAffiliateCTA: { cta: 'Vedi i tour' },
|
|
234
|
+
stickyCTA: {
|
|
235
|
+
label: 'Prenota il tuo posto',
|
|
236
|
+
note: 'Hai trovato il tour giusto? Prenota il tuo posto prima che si esaurisca.',
|
|
237
|
+
dismissLabel: 'Chiudi',
|
|
238
|
+
},
|
|
239
|
+
travelpayoutsWidget: {
|
|
240
|
+
hotel: 'Ricerca hotel',
|
|
241
|
+
activity: 'Ricerca attività',
|
|
242
|
+
train: 'Ricerca treni e autobus',
|
|
243
|
+
car: 'Ricerca noleggio auto',
|
|
244
|
+
},
|
|
245
|
+
cardCarousel: {
|
|
246
|
+
viewAllLabel: 'Vedi tutto',
|
|
247
|
+
regionLabel: 'Carosello',
|
|
248
|
+
previousLabel: (name: string | undefined) => `Precedente, ${name ?? 'carosello'}`,
|
|
249
|
+
nextLabel: (name: string | undefined) => `Successivo, ${name ?? 'carosello'}`,
|
|
250
|
+
},
|
|
251
|
+
faq: { title: 'Domande frequenti' },
|
|
252
|
+
pagination: {
|
|
253
|
+
ariaLabel: 'Paginazione',
|
|
254
|
+
previousLabel: 'Precedente',
|
|
255
|
+
nextLabel: 'Successiva',
|
|
256
|
+
pageLabel: (page: number) => `Vai alla pagina ${page}`,
|
|
257
|
+
currentPageLabel: (page: number) => `Pagina ${page}, pagina corrente`,
|
|
258
|
+
},
|
|
259
|
+
tableOfContents: {
|
|
260
|
+
ariaLabel: 'Indice dei contenuti',
|
|
261
|
+
jumpLabel: 'Salta a una sezione',
|
|
262
|
+
stickyLabel: (name: string) => `${name} (fisso)`,
|
|
263
|
+
},
|
|
264
|
+
alsoExplore: { eyebrow: 'Esplora anche' },
|
|
265
|
+
articleCategoryNav: { ariaLabel: 'Sfoglia gli articoli per argomento', allLabel: 'Tutti' },
|
|
266
|
+
articleFeatureCard: { readLabel: 'Leggi l’articolo', updatedLabel: 'Aggiornato' },
|
|
267
|
+
eraChip: { ariaLabel: (label: string, range: string) => `${label}, ${range}: vedi quest’epoca nella cronologia` },
|
|
268
|
+
personChip: { ariaLabel: (name: string, dates?: string) => `${name}${dates ? `, ${dates}` : ''}: leggi il profilo` },
|
|
269
|
+
eraPeopleRow: { peopleLabel: 'Personaggi:', more: (n: number) => `+${n} altri`, moreSr: ' personaggi', fewer: 'Mostra meno' },
|
|
270
|
+
personCard: { cta: 'Leggi il profilo' },
|
|
271
|
+
peopleChips: { heading: 'Personaggi in questa storia' },
|
|
272
|
+
peopleBand: { allLabel: 'Tutti i personaggi storici' },
|
|
273
|
+
peopleTimeline: {
|
|
274
|
+
ariaLabel: 'Personaggi per epoca',
|
|
275
|
+
approximate: 'data sconosciuta, collocata a metà epoca',
|
|
276
|
+
dotLabel: (name: string, dates?: string) => (dates ? `${name}, ${dates}` : name),
|
|
277
|
+
},
|
|
278
|
+
peopleHub: {
|
|
279
|
+
indexLabel: 'Salta a un’epoca',
|
|
280
|
+
footstepsHeading: 'Sulle loro tracce',
|
|
281
|
+
placesHeading: 'Dove trovarli',
|
|
282
|
+
},
|
|
283
|
+
personRoute: { monumentKind: 'Monumento', personKind: 'Personaggio storico' },
|
|
284
|
+
personPage: {
|
|
285
|
+
readFullStory: 'Leggi la storia completa',
|
|
286
|
+
fullStoryHeading: 'La storia completa',
|
|
287
|
+
placesHeading: 'Luoghi da vedere',
|
|
288
|
+
readMoreHeading: 'Per approfondire',
|
|
289
|
+
timelineHeading: 'Nel suo tempo',
|
|
290
|
+
alsoKnownAs: 'Conosciuto anche come',
|
|
291
|
+
lifespan: (years: string, circa?: boolean, age?: number) =>
|
|
292
|
+
`Visse ${circa ? 'ca. ' : ''}${years}${age ? ` (circa ${age} anni)` : ''}`,
|
|
293
|
+
born: (year: string, circa?: boolean) => `Nascita ${circa ? 'ca. ' : ''}${year}`,
|
|
294
|
+
died: (year: string, circa?: boolean) => `Morte ${circa ? 'ca. ' : ''}${year}`,
|
|
295
|
+
tocLabels: { biography: 'Biografia', places: 'Luoghi', timeline: 'Cronologia', readMore: 'Per approfondire' },
|
|
296
|
+
},
|
|
297
|
+
articleTopicPager: {
|
|
298
|
+
heading: (topic: string) => `Continua in ${topic}`,
|
|
299
|
+
newerLabel: 'Più recente',
|
|
300
|
+
olderLabel: 'Precedente',
|
|
301
|
+
allLabel: (topic: string, count?: number) => (count ? `Tutti i ${count} articoli su ${topic}` : `Tutti gli articoli su ${topic}`),
|
|
302
|
+
},
|
|
303
|
+
notFoundPage: { exploreAriaLabel: 'Esplora le sezioni', searchShortcut: '⌘K' },
|
|
304
|
+
visitTiming: { title: 'Quando visitare', bestSeason: 'Periodo migliore', quietestHours: 'Orari più tranquilli', visitDuration: 'Durata della visita' },
|
|
305
|
+
articlesNavMenu: { latestHeading: 'Ultimi articoli' },
|
|
306
|
+
siteFooter: { cookieLabel: 'Preferenze cookie', rightsLabel: 'Tutti i diritti riservati.', legalAriaLabel: 'Note legali' },
|
|
307
|
+
siteHeader: { label: 'Navigazione principale', openLabel: 'Apri menu', closeLabel: 'Chiudi menu' },
|
|
308
|
+
articleMetadata: {
|
|
309
|
+
writtenByLabel: 'Scritto da',
|
|
310
|
+
portraitLabel: 'Ritratto di',
|
|
311
|
+
updatedLabel: 'Aggiornato il',
|
|
312
|
+
publishedLabel: 'Pubblicato il',
|
|
313
|
+
ariaLabel: 'Informazioni sull’articolo',
|
|
314
|
+
},
|
|
315
|
+
authoritativeSources: {
|
|
316
|
+
title: 'Fonti',
|
|
317
|
+
eyebrow: 'Per approfondire',
|
|
318
|
+
countLabel: 'riferimenti',
|
|
319
|
+
showLabel: 'Mostra',
|
|
320
|
+
hideLabel: 'Nascondi',
|
|
321
|
+
newTabLabel: '(si apre in una nuova scheda)',
|
|
322
|
+
},
|
|
323
|
+
breadcrumb: { homeLabel: 'Home', ariaLabel: 'Percorso di navigazione' },
|
|
324
|
+
chronologyTimeline: {
|
|
325
|
+
...eraLabelsIt,
|
|
326
|
+
emptyLabel: '',
|
|
327
|
+
undatedLabel: 'Senza data',
|
|
328
|
+
},
|
|
329
|
+
eraTimelineNav: { ariaLabel: 'Epoche' },
|
|
330
|
+
eraScenes: {
|
|
331
|
+
...eraLabelsIt,
|
|
332
|
+
castLabel: 'In quest’epoca',
|
|
333
|
+
peopleHeading: 'Personaggi',
|
|
334
|
+
monumentsHeading: 'Monumenti',
|
|
335
|
+
articlesHeading: 'Articoli',
|
|
336
|
+
allArticlesLabel: (count: number) => `Tutti i ${count} articoli`,
|
|
337
|
+
portraitAlt: (name: string) => `Ritratto di ${name}`,
|
|
338
|
+
},
|
|
339
|
+
dossierSection: {
|
|
340
|
+
viewAllLabel: 'Vedi tutto',
|
|
341
|
+
fallbackTitle: 'Altro da questo dossier',
|
|
342
|
+
themeLabels: {
|
|
343
|
+
gastronomy: 'Gastronomia',
|
|
344
|
+
nightlife: 'Vita notturna',
|
|
345
|
+
history: 'Storia',
|
|
346
|
+
religious: 'Patrimonio religioso',
|
|
347
|
+
architecture: 'Architettura',
|
|
348
|
+
art: 'Arte',
|
|
349
|
+
nature: 'Natura',
|
|
350
|
+
entertainment: 'Intrattenimento',
|
|
351
|
+
shopping: 'Shopping',
|
|
352
|
+
wellness: 'Benessere',
|
|
353
|
+
cultural: 'Cultura',
|
|
354
|
+
} as Record<string, string>,
|
|
355
|
+
},
|
|
356
|
+
eraListing: {
|
|
357
|
+
homeLabel: 'Home',
|
|
358
|
+
articlesLabel: 'Articoli',
|
|
359
|
+
articleSchemaType: 'Article',
|
|
360
|
+
eyebrow: (era: string) => `Articoli · ${era}`,
|
|
361
|
+
listHeading: (era: string) => `Articoli su ${era}`,
|
|
362
|
+
heroAlt: (era: string, place: string, range: string) => `${era} a ${place}, ${range}`,
|
|
363
|
+
articleOne: 'articolo',
|
|
364
|
+
articleMany: 'articoli',
|
|
365
|
+
pageLabel: (page: number) => `Pagina ${page}`,
|
|
366
|
+
timelineLink: (era: string) => `Vedi ${era} nella cronologia, con i suoi personaggi e monumenti`,
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export const LABELS_BY_LOCALE = {
|
|
371
|
+
en: LABELS,
|
|
372
|
+
it: LABELS_IT,
|
|
373
|
+
} as const;
|
|
374
|
+
|
|
375
|
+
export function getLabels(locale?: string): typeof LABELS {
|
|
376
|
+
if (!locale) return LABELS;
|
|
377
|
+
const lang = locale.split(/[-_]/)[0]?.toLowerCase() ?? 'en';
|
|
378
|
+
return (LABELS_BY_LOCALE as Record<string, typeof LABELS>)[lang] ?? LABELS;
|
|
379
|
+
}
|
|
@@ -29,6 +29,8 @@ interface Props {
|
|
|
29
29
|
ogImageAlt?: string;
|
|
30
30
|
ogType?: string;
|
|
31
31
|
ogLocale?: string;
|
|
32
|
+
/** BCP-47 locale (e.g. `it-IT`); derives `og:locale` (`it_IT`) when `ogLocale` is not given. */
|
|
33
|
+
locale?: string;
|
|
32
34
|
articleAuthor?: string;
|
|
33
35
|
/** Absolute URL of the author's profile page, resolved by the site. */
|
|
34
36
|
articleAuthorUrl?: string;
|
|
@@ -63,7 +65,8 @@ const {
|
|
|
63
65
|
ogImage = '/og-default.jpg',
|
|
64
66
|
ogImageAlt,
|
|
65
67
|
ogType,
|
|
66
|
-
ogLocale
|
|
68
|
+
ogLocale: providedOgLocale,
|
|
69
|
+
locale,
|
|
67
70
|
articleAuthor,
|
|
68
71
|
articleAuthorUrl,
|
|
69
72
|
articlePublishedTime,
|
|
@@ -73,7 +76,7 @@ const {
|
|
|
73
76
|
preloadImage,
|
|
74
77
|
twitterHandle,
|
|
75
78
|
themeColor,
|
|
76
|
-
lang = 'en',
|
|
79
|
+
lang = Astro.currentLocale ?? 'en',
|
|
77
80
|
rssTitle = siteName,
|
|
78
81
|
stylesheets = [],
|
|
79
82
|
gtmId,
|
|
@@ -85,6 +88,8 @@ const {
|
|
|
85
88
|
footerClass,
|
|
86
89
|
} = Astro.props;
|
|
87
90
|
|
|
91
|
+
const ogLocale = providedOgLocale ?? (locale ? locale.replace('-', '_') : (lang === 'en' ? 'en' : lang));
|
|
92
|
+
|
|
88
93
|
const socialTitle = ogTitle ?? title;
|
|
89
94
|
const baseUrl = import.meta.env.BASE_URL.replace(/\/$/, '');
|
|
90
95
|
const canonicalUrl = providedCanonicalUrl
|
|
@@ -15,7 +15,7 @@ import MobileNavLink from './MobileNavLink.astro';
|
|
|
15
15
|
import { isActivePath } from './activePath.ts';
|
|
16
16
|
import { TONES } from './tones.ts';
|
|
17
17
|
import type { ArticlesNavProps } from './types.ts';
|
|
18
|
-
import {
|
|
18
|
+
import { getLabels } from '../internal/labels';
|
|
19
19
|
|
|
20
20
|
type Props = ArticlesNavProps;
|
|
21
21
|
|
|
@@ -27,7 +27,8 @@ const {
|
|
|
27
27
|
tone = 'primary',
|
|
28
28
|
topicsHeading,
|
|
29
29
|
topics,
|
|
30
|
-
|
|
30
|
+
locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
|
|
31
|
+
latestHeading = getLabels(locale).articlesNavMenu.latestHeading,
|
|
31
32
|
latest = [],
|
|
32
33
|
all,
|
|
33
34
|
iconStyle = 'plain',
|
|
@@ -47,7 +48,7 @@ const sectionActive = on(all.href);
|
|
|
47
48
|
|
|
48
49
|
const heading = 'text-xs font-semibold text-muted-foreground uppercase tracking-wide';
|
|
49
50
|
const ring = `focus-visible:ring-2 ${t.ring} focus-visible:ring-offset-2`;
|
|
50
|
-
const day = (iso?: string) => formatUtcDate(iso, { day: 'numeric', month: 'short' },
|
|
51
|
+
const day = (iso?: string) => formatUtcDate(iso, { day: 'numeric', month: 'short' }, locale);
|
|
51
52
|
|
|
52
53
|
const [first, ...rest] = latest;
|
|
53
54
|
const feature = first?.image ? first : undefined;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Icon } from '../primitives/index.ts';
|
|
9
9
|
import type { FooterSection, NavLink, SiteIdentity } from './types.ts';
|
|
10
|
-
import {
|
|
10
|
+
import { getLabels } from '../internal/labels';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
identity: SiteIdentity;
|
|
@@ -21,6 +21,7 @@ interface Props {
|
|
|
21
21
|
/** Shown between legal items (aria-hidden), e.g. `|`. */
|
|
22
22
|
separator?: string;
|
|
23
23
|
year?: number;
|
|
24
|
+
locale?: string;
|
|
24
25
|
class?: string;
|
|
25
26
|
gridClass?: string;
|
|
26
27
|
brandClass?: string;
|
|
@@ -35,13 +36,15 @@ interface Props {
|
|
|
35
36
|
ringClass?: string;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).siteFooter;
|
|
40
|
+
|
|
38
41
|
const {
|
|
39
42
|
identity,
|
|
40
43
|
sections = [],
|
|
41
44
|
legal = [],
|
|
42
|
-
cookieLabel =
|
|
43
|
-
rightsLabel =
|
|
44
|
-
legalAriaLabel =
|
|
45
|
+
cookieLabel = defaultLabels.cookieLabel,
|
|
46
|
+
rightsLabel = defaultLabels.rightsLabel,
|
|
47
|
+
legalAriaLabel = defaultLabels.legalAriaLabel,
|
|
45
48
|
separator,
|
|
46
49
|
year = new Date().getFullYear(),
|
|
47
50
|
class: className = 'bg-inverse text-inverse-muted',
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* `<nav>`, so it carries its own `data-pagefind-ignore`.
|
|
13
13
|
*/
|
|
14
14
|
import { Icon } from '../primitives/index.ts';
|
|
15
|
-
import {
|
|
15
|
+
import { getLabels } from '../internal/labels';
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
18
|
label?: string;
|
|
@@ -24,18 +24,21 @@ interface Props {
|
|
|
24
24
|
openLabel?: string;
|
|
25
25
|
closeLabel?: string;
|
|
26
26
|
searchPath?: string;
|
|
27
|
+
locale?: string;
|
|
27
28
|
id?: string;
|
|
28
29
|
panelId?: string;
|
|
29
30
|
toggleId?: string;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).siteHeader;
|
|
34
|
+
|
|
32
35
|
const {
|
|
33
|
-
label =
|
|
36
|
+
label = defaultLabels.label,
|
|
34
37
|
surfaceClass = 'bg-background/95 backdrop-blur-md',
|
|
35
38
|
class: className = `fixed top-0 left-0 right-0 z-50 transition-[background-color,backdrop-filter,border-color,box-shadow] duration-300 border-b border-border ${surfaceClass}`,
|
|
36
39
|
toggleClass = 'p-2 min-h-[44px] min-w-[44px] flex items-center justify-center rounded-lg transition-colors text-foreground hover:bg-muted cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2',
|
|
37
|
-
openLabel =
|
|
38
|
-
closeLabel =
|
|
40
|
+
openLabel = defaultLabels.openLabel,
|
|
41
|
+
closeLabel = defaultLabels.closeLabel,
|
|
39
42
|
searchPath,
|
|
40
43
|
id = 'main-nav',
|
|
41
44
|
panelId = 'mobile-menu',
|
package/src/navigation/types.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { formatDisplayDay } from '@sarimarcus/content-sites-core/dates';
|
|
|
20
20
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
21
21
|
import EraChip from '../editorial/EraChip.astro';
|
|
22
22
|
import type { ArticleAuthor } from './types';
|
|
23
|
-
import {
|
|
23
|
+
import { getLabels } from '../internal/labels';
|
|
24
24
|
|
|
25
25
|
interface Props {
|
|
26
26
|
author?: ArticleAuthor | null;
|
|
@@ -46,17 +46,19 @@ interface Props {
|
|
|
46
46
|
eraBasePath?: string;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale);
|
|
50
|
+
|
|
49
51
|
const {
|
|
50
52
|
author,
|
|
51
53
|
datePublished,
|
|
52
54
|
dateModified,
|
|
53
55
|
timeZone = 'UTC',
|
|
54
|
-
locale = 'en-GB',
|
|
55
|
-
writtenByLabel =
|
|
56
|
-
portraitLabel =
|
|
57
|
-
updatedLabel =
|
|
58
|
-
publishedLabel =
|
|
59
|
-
ariaLabel =
|
|
56
|
+
locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
|
|
57
|
+
writtenByLabel = defaultLabels.articleMetadata.writtenByLabel,
|
|
58
|
+
portraitLabel = defaultLabels.articleMetadata.portraitLabel,
|
|
59
|
+
updatedLabel = defaultLabels.articleMetadata.updatedLabel,
|
|
60
|
+
publishedLabel = defaultLabels.articleMetadata.publishedLabel,
|
|
61
|
+
ariaLabel = defaultLabels.articleMetadata.ariaLabel,
|
|
60
62
|
placeholderClass = 'bg-gradient-to-br from-primary/20 to-accent/20',
|
|
61
63
|
updatedIconClass = 'text-primary',
|
|
62
64
|
bylineWhitespace = 'flat',
|