feat: add localisation

This commit is contained in:
2026-07-31 21:46:05 +02:00
parent b58c9a8722
commit f5b2041612
30 changed files with 4099 additions and 326 deletions
+9 -7
View File
@@ -2,19 +2,21 @@ import 'package:flutter/material.dart';
import 'package:kooltab2/viewmodels/bar_screen_view_model.dart';
import 'package:provider/provider.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import '../../l10n/app_localizations.dart';
Future<void> showNewTabDialog(BuildContext context) async {
final l10n = AppLocalizations.of(context);
final controller = TextEditingController();
final name = await showDialog<String>(
context: context,
builder: (dialogContext) {
return AlertDialog(
title: const Text('Open new tab'),
title: Text(l10n.openNewTab),
content: TextField(
controller: controller,
autofocus: true,
decoration: const InputDecoration(labelText: 'Customer / group name'),
decoration: InputDecoration(labelText: l10n.customerGroupName),
onSubmitted: (value) {
Navigator.of(dialogContext).pop(value);
},
@@ -23,13 +25,13 @@ Future<void> showNewTabDialog(BuildContext context) async {
actions: [
TextButton(
onPressed: () => Navigator.of(dialogContext).pop(),
child: const Text('Cancel'),
child: Text(l10n.cancel),
),
FilledButton(
onPressed: () {
Navigator.of(dialogContext).pop(controller.text);
},
child: const Text('Open tab'),
child: Text(l10n.openTab),
),
],
);
@@ -45,8 +47,8 @@ Future<void> showNewTabDialog(BuildContext context) async {
} catch (e, stack) {
Sentry.captureException(e, stackTrace: stack);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Could not create tab: $e')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(l10n.couldNotCreateTabMessage)));
}
}