Files
Client/lib/widget/a11y/a11y_labels.dart
T

50 lines
1.7 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import '../../extensions/date_time.dart';
/// Zentrale deutschsprachige Screenreader-Labels. Single Source of Truth für
/// alle `Semantics`/`semanticLabel`/`tooltip`-Texte und der eine Punkt, an
/// dem später echtes l10n andockt (die App ist aktuell fest auf `de`).
abstract final class A11yLabels {
// Zustände
static const loading = 'Lädt';
static const downloadingFile = 'Lädt herunter';
// Chat
static const messageRead = 'Gelesen';
static const messageSent = 'Gesendet';
static const unread = 'Ungelesen';
static const favorite = 'Favorit';
static const draft = 'Entwurf';
static const yourReaction = 'deine Reaktion';
// Bilder
static const profilePicture = 'Profilbild';
static const groupPicture = 'Gruppenbild';
static const roomPlan = 'Raumplan der Schule als Grafik';
// Stundenplan
static const cancelled = 'Ausfall';
static const breakTime = 'Pause';
static const allDay = 'Ganztägig';
/// Beschreibt eine Stundenplan-Kachel für den Screenreader, z.B.
/// „Mathe, Raum 101, 08:0008:45, Ausfall". Zeilenumbrüche in [location]
/// (Raum/Lehrer stehen dort mehrzeilig) werden zu Trennern geglättet.
static String appointmentLabel({
required String subject,
required String location,
required DateTime start,
required DateTime end,
required bool crossedOut,
}) {
final parts = <String>[subject];
final loc = location.replaceAll('\n', ', ').trim();
if (loc.isNotEmpty) parts.add(loc);
parts.add('${start.formatHm()}${end.formatHm()}');
if (crossedOut) parts.add(cancelled);
return parts.join(', ');
}
/// „+3 weitere Termine" für die zusammengefasste Overflow-Kachel.
static String moreAppointments(int count) => '+$count weitere Termine';
}