Add Swedish localization for various app actions and inventory management strings

This commit is contained in:
Nils-Johan Gynther
2026-05-02 15:42:00 +02:00
parent 4e81f56225
commit 2563738fcf
24 changed files with 4510 additions and 366 deletions
@@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
import '../../../core/api/api_error_mapper.dart';
import '../../../core/api/api_exception.dart';
import '../../../core/l10n/l10n.dart';
import '../../auth/data/auth_providers.dart';
import '../data/recipe_providers.dart';
import '../domain/parsed_recipe.dart';
@@ -84,7 +85,7 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
Future<void> _parseMarkdown() async {
final markdown = _markdownCtrl.text.trim();
if (markdown.isEmpty) {
setState(() => _parseError = 'Klistra in eller skriv ett recept i Markdown-format.');
setState(() => _parseError = context.l10n.recipeCreateMarkdownHint);
return;
}
setState(() {
@@ -117,7 +118,7 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
Future<void> _save() async {
final name = _nameCtrl.text.trim();
if (name.isEmpty) {
setState(() => _saveError = 'Receptnamnet får inte vara tomt.');
setState(() => _saveError = context.l10n.recipeCreateNameRequired);
return;
}
@@ -175,7 +176,7 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
return Scaffold(
appBar: AppBar(
title:
Text(_step == _Step.input ? 'Nytt recept' : 'Granska ingredienser'),
Text(_step == _Step.input ? context.l10n.recipeCreateTitle : context.l10n.recipeCreateReviewIngredients),
leading: _step == _Step.review
? IconButton(
icon: const Icon(Icons.arrow_back),
@@ -202,9 +203,9 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
maxLines: null,
expands: true,
textAlignVertical: TextAlignVertical.top,
decoration: const InputDecoration(
hintText: '# Receptnamn\n\n## Ingredienser\n- 500 g köttfärs\n- 1 st lök\n\n## Tillvägagångssätt\nStek löken...',
border: OutlineInputBorder(),
decoration: InputDecoration(
hintText: context.l10n.recipeCreateMarkdownPlaceholder,
border: const OutlineInputBorder(),
alignLabelWithHint: true,
),
),
@@ -230,7 +231,7 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
width: 18,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Text('Granska ingredienser'),
: Text(context.l10n.recipeCreateReviewIngredients),
),
),
),
@@ -248,22 +249,22 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
children: [
TextField(
controller: _nameCtrl,
decoration: const InputDecoration(labelText: 'Receptnamn'),
decoration: InputDecoration(labelText: context.l10n.recipeEditNameLabel),
),
const SizedBox(height: 12),
TextField(
controller: _servingsCtrl,
decoration: const InputDecoration(
labelText: 'Antal portioner (valfritt)'),
decoration: InputDecoration(
labelText: context.l10n.recipeEditServingsLabel),
keyboardType: TextInputType.number,
),
if (parsed.ingredients.isNotEmpty) ...[
const SizedBox(height: 20),
Text('Ingredienser',
Text(context.l10n.recipeEditIngredientsLabel,
style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 4),
Text(
'Bocka av ingredienser att inkludera och välj rätt produkt.',
context.l10n.recipeCreateIngredientsHint,
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 8),
@@ -295,7 +296,7 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
width: 18,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Text('Spara recept'),
: Text(context.l10n.recipeCreateSaveAction),
),
),
),
@@ -321,7 +322,7 @@ class _CreateRecipeScreenState extends ConsumerState<CreateRecipeScreen> {
title: Text(label),
subtitle: ing.suggestions.isEmpty
? Text(
'Ingen produkt hittades — ingrediensen hoppas över.',
context.l10n.recipeCreateNoProductFound,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant,
fontSize: 12),