Écran d'entrée, une fois par session, 11 langues. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011VxSQeGQYUvPmSEoGdnidA
74 lines
2.4 KiB
TypeScript
74 lines
2.4 KiB
TypeScript
type AnyTranslation = { language?: string; value?: string }
|
||
|
||
export function t(translations: AnyTranslation[] | undefined, lang: string): string {
|
||
if (!translations || translations.length === 0) return ''
|
||
return (
|
||
translations.find((t) => t.language === lang)?.value ||
|
||
translations.find((t) => t.language === 'FR')?.value ||
|
||
translations[0]?.value ||
|
||
''
|
||
)
|
||
}
|
||
|
||
const UI_STRINGS: Record<string, Record<string, string>> = {
|
||
aiGeneratedImage: {
|
||
FR: 'Image générée par IA',
|
||
NL: 'Beeld gegenereerd door AI',
|
||
EN: 'AI-generated image',
|
||
DE: 'KI-generiertes Bild',
|
||
ES: 'Imagen generada por IA',
|
||
IT: 'Immagine generata dall’IA',
|
||
PL: 'Obraz wygenerowany przez SI',
|
||
CN: '人工智能生成的图像',
|
||
AR: 'صورة من إنتاج الذكاء الاصطناعي',
|
||
UK: 'Зображення, створене ШІ',
|
||
LB: 'Bild generéiert vun der KI',
|
||
},
|
||
castingTitle: {
|
||
FR: 'Les personnes que vous allez rencontrer',
|
||
NL: 'De personen die u zult ontmoeten',
|
||
EN: 'The people you will meet',
|
||
DE: 'Die Menschen, denen Sie begegnen werden',
|
||
ES: 'Las personas que va a conocer',
|
||
IT: 'Le persone che incontrerete',
|
||
PL: 'Osoby, które spotkasz',
|
||
CN: '您将遇到的人物',
|
||
AR: 'الشخصيات التي ستلتقيها',
|
||
UK: 'Люди, яких ви зустрінете',
|
||
LB: "D'Leit, déi Dir kenne léiert",
|
||
},
|
||
castingStart: {
|
||
FR: 'Commencer la visite',
|
||
NL: 'Het bezoek beginnen',
|
||
EN: 'Start the visit',
|
||
DE: 'Besuch beginnen',
|
||
ES: 'Empezar la visita',
|
||
IT: 'Inizia la visita',
|
||
PL: 'Rozpocznij zwiedzanie',
|
||
CN: '开始参观',
|
||
AR: 'ابدأ الزيارة',
|
||
UK: 'Почати відвідування',
|
||
LB: 'Besuch ufänken',
|
||
},
|
||
noEventsThisMonth: {
|
||
FR: 'Aucun événement ce mois-ci',
|
||
NL: 'Geen evenementen deze maand',
|
||
EN: 'No events this month',
|
||
DE: 'Keine Veranstaltungen diesen Monat',
|
||
ES: 'No hay eventos este mes',
|
||
IT: 'Nessun evento questo mese',
|
||
},
|
||
}
|
||
|
||
export function ui(key: keyof typeof UI_STRINGS, lang: string): string {
|
||
return UI_STRINGS[key]?.[lang] ?? UI_STRINGS[key]?.['FR'] ?? key
|
||
}
|
||
|
||
export function stripHtml(html: string): string {
|
||
return html.replace(/<[^>]*>/g, '').trim()
|
||
}
|
||
|
||
export function tPlain(translations: AnyTranslation[] | undefined, lang: string): string {
|
||
return stripHtml(t(translations, lang))
|
||
}
|