Add Swedish localization for various app actions and inventory management strings
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../core/l10n/l10n.dart';
|
||||
|
||||
/// Visar en dialogruta med ett felmeddelande och en kopieringsknapp.
|
||||
void showErrorDialog(BuildContext context, String errorMessage) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Fel'),
|
||||
title: Text(context.l10n.errorDialogTitle),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -17,17 +19,17 @@ void showErrorDialog(BuildContext context, String errorMessage) {
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('Stäng'),
|
||||
child: Text(context.l10n.errorDialogClose),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('Kopiera'),
|
||||
child: Text(context.l10n.errorDialogCopy),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: errorMessage));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Felmeddelande kopierat!')),
|
||||
SnackBar(content: Text(context.l10n.errorDialogCopied)),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../../core/utils/global_error_handler.dart';
|
||||
import '../../../core/l10n/l10n.dart';
|
||||
import '../../auth/data/auth_providers.dart';
|
||||
import '../data/import_providers.dart';
|
||||
|
||||
@@ -113,8 +114,7 @@ class _RecipeImportTabState extends ConsumerState<RecipeImportTab> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Ladda upp en PDF eller bild, eller ange en receptlänk — '
|
||||
'receptet importeras och öppnas direkt i redigeringsläget.',
|
||||
context.l10n.importTabDescription,
|
||||
style: theme.textTheme.bodyMedium
|
||||
?.copyWith(color: theme.colorScheme.onSurfaceVariant),
|
||||
),
|
||||
@@ -122,16 +122,16 @@ class _RecipeImportTabState extends ConsumerState<RecipeImportTab> {
|
||||
|
||||
// ── Metodväljare ────────────────────────────────────────────────
|
||||
SegmentedButton<_Method>(
|
||||
segments: const [
|
||||
segments: [
|
||||
ButtonSegment(
|
||||
value: _Method.file,
|
||||
label: Text('Fil / PDF'),
|
||||
icon: Icon(Icons.upload_file_outlined),
|
||||
label: Text(context.l10n.importFileTabLabel),
|
||||
icon: const Icon(Icons.upload_file_outlined),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: _Method.url,
|
||||
label: Text('Länk'),
|
||||
icon: Icon(Icons.link),
|
||||
label: Text(context.l10n.importLinkTabLabel),
|
||||
icon: const Icon(Icons.link),
|
||||
),
|
||||
],
|
||||
selected: {_method},
|
||||
@@ -147,7 +147,7 @@ class _RecipeImportTabState extends ConsumerState<RecipeImportTab> {
|
||||
icon: const Icon(Icons.attach_file),
|
||||
label: Text(
|
||||
_pickedFile == null
|
||||
? 'Välj fil (PDF, PNG, JPG, WEBP, BMP)'
|
||||
? context.l10n.importChooseFileAction
|
||||
: _pickedFile!.name,
|
||||
),
|
||||
),
|
||||
@@ -168,11 +168,11 @@ class _RecipeImportTabState extends ConsumerState<RecipeImportTab> {
|
||||
keyboardType: TextInputType.url,
|
||||
autofocus: true,
|
||||
enabled: !_isLoading,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Receptlänk',
|
||||
hintText: 'https://exempel.se/recept/...',
|
||||
prefixIcon: Icon(Icons.link),
|
||||
border: OutlineInputBorder(),
|
||||
decoration: InputDecoration(
|
||||
labelText: context.l10n.importLinkLabel,
|
||||
hintText: context.l10n.importLinkHint,
|
||||
prefixIcon: const Icon(Icons.link),
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
onSubmitted: (_) {
|
||||
if (_canSubmit) _submit();
|
||||
@@ -187,7 +187,7 @@ class _RecipeImportTabState extends ConsumerState<RecipeImportTab> {
|
||||
const LinearProgressIndicator(),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Tolkar receptet — detta kan ta upp till en minut...',
|
||||
context.l10n.importFileProcessing,
|
||||
style: theme.textTheme.bodySmall
|
||||
?.copyWith(color: theme.colorScheme.onSurfaceVariant),
|
||||
),
|
||||
@@ -200,8 +200,8 @@ class _RecipeImportTabState extends ConsumerState<RecipeImportTab> {
|
||||
onPressed: _canSubmit ? _submit : null,
|
||||
icon: const Icon(Icons.auto_awesome_outlined),
|
||||
label: Text(_method == _Method.file
|
||||
? 'Importera fil'
|
||||
: 'Importera från länk'),
|
||||
? context.l10n.importFileAction
|
||||
: context.l10n.importLinkAction),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
@@ -212,7 +212,7 @@ class _RecipeImportTabState extends ConsumerState<RecipeImportTab> {
|
||||
TextButton.icon(
|
||||
onPressed: () => context.push('/recipes/create'),
|
||||
icon: const Icon(Icons.edit_outlined),
|
||||
label: const Text('Skriv in recept istället'),
|
||||
label: Text(context.l10n.importWriteInstead),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user