--- import { getCollection } from 'astro:content'; import { t, type Locale } from '../../utils/i18n'; interface Props { images: { src: string; alt: string; title?: string }[]; albumTitle?: string; showCategory?: boolean; category?: string; lang?: Locale; } const { images, albumTitle = '', showCategory = false, category = '', lang = 'fr' } = Astro.props; const imagesForJS = JSON.stringify(images); // Construire les labels depuis la collection filtrée par langue const allCategories = await getCollection('photoCategories'); const langCategories = allCategories.filter(c => (c.data.lang ?? 'fr') === lang); const effectiveCategories = langCategories.length > 0 ? langCategories : allCategories.filter(c => (c.data.lang ?? 'fr') === 'fr'); const categoryLabels: Record = { 'blog': t('photo', 'photoFeed', lang), ...Object.fromEntries(effectiveCategories.map(cat => [cat.id.replace(/\.(en|ar)$/, ''), cat.data.title])) }; ---