feat: erweiterte Chat-Funktionalität, UI-Verbesserungen und Lokalisierungsupdates
- Chat: Nachrichten-Status (read/unread), WebSocket-Verbesserungen - App: Login-Optimierung, Job-Übersicht verbessert, neue Übersetzungen - Backend: Dialog-Styling, Invoice-Generator, Job-Verwaltung erweitert - Mehrsprachigkeit: Neue Übersetzungen für DE, EN, ES, ET, FR, LT, LV, PL, RU, TR
This commit is contained in:
50
app/lib/l10n/localization_helpers.dart
Normal file
50
app/lib/l10n/localization_helpers.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../models/chat.dart';
|
||||
import 'app_localizations.dart';
|
||||
|
||||
String localizeKnownText(BuildContext context, String text) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
switch (text.trim()) {
|
||||
case 'Auftragsdetails':
|
||||
return l10n.jobDetails;
|
||||
case 'Aufgaben eines Auftrags':
|
||||
return l10n.jobTasks;
|
||||
case 'Unterschrift':
|
||||
return l10n.signature;
|
||||
case 'Allgemeine Nachrichten':
|
||||
return l10n.generalMessages;
|
||||
case 'Telefon':
|
||||
return l10n.phone;
|
||||
case 'Erstellt':
|
||||
return l10n.created;
|
||||
case 'E-Mail-Adresse':
|
||||
return l10n.emailAddress;
|
||||
case 'Passwort':
|
||||
return l10n.password;
|
||||
case 'Anmelden':
|
||||
return l10n.login;
|
||||
default:
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
String localizedStationLabel(
|
||||
BuildContext context,
|
||||
int number, {
|
||||
String? suffix,
|
||||
}) {
|
||||
final base = AppLocalizations.of(context).stationNumber(number);
|
||||
final trimmedSuffix = suffix?.trim() ?? '';
|
||||
if (trimmedSuffix.isEmpty) {
|
||||
return base;
|
||||
}
|
||||
return '$base: ${localizeKnownText(context, trimmedSuffix)}';
|
||||
}
|
||||
|
||||
String localizedChatTitle(BuildContext context, Chat chat) {
|
||||
if (chat.type == ChatType.general) {
|
||||
return AppLocalizations.of(context).generalMessages;
|
||||
}
|
||||
return localizeKnownText(context, chat.title);
|
||||
}
|
||||
Reference in New Issue
Block a user