refactor: enhance localizations

This commit is contained in:
cogwheel0
2025-08-28 23:46:32 +05:30
parent 6dabd108f9
commit 86d18ee0fb
14 changed files with 788 additions and 353 deletions

View File

@@ -802,7 +802,7 @@ class _ChatPageState extends ConsumerState<ChatPage> {
borderRadius: BorderRadius.circular(AppBorderRadius.dialog),
),
title: Text(
'Edit Message',
AppLocalizations.of(context)!.editMessage,
style: TextStyle(color: context.conduitTheme.textPrimary),
),
content: TextField(

View File

@@ -551,7 +551,7 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
icon: Platform.isIOS
? CupertinoIcons.doc_on_clipboard
: Icons.content_copy,
label: 'Copy',
label: AppLocalizations.of(context)!.copy,
onTap: widget.onCopy,
),
if (isErrorMessage) ...[
@@ -565,7 +565,7 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
] else ...[
_buildActionButton(
icon: Platform.isIOS ? CupertinoIcons.refresh : Icons.refresh,
label: 'Regenerate',
label: AppLocalizations.of(context)!.regenerate,
onTap: widget.onRegenerate,
),
],

View File

@@ -7,6 +7,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'dart:io' show Platform;
import 'package:conduit/l10n/app_localizations.dart';
class UserMessageBubble extends ConsumerStatefulWidget {
final dynamic message;
@@ -581,14 +582,14 @@ class _UserMessageBubbleState extends ConsumerState<UserMessageBubble>
children: [
_buildActionButton(
icon: Platform.isIOS ? CupertinoIcons.pencil : Icons.edit_outlined,
label: 'Edit',
label: AppLocalizations.of(context)!.edit,
onTap: widget.onEdit,
),
_buildActionButton(
icon: Platform.isIOS
? CupertinoIcons.doc_on_clipboard
: Icons.content_copy,
label: 'Copy',
label: AppLocalizations.of(context)!.copy,
onTap: widget.onCopy,
),
],

View File

@@ -255,7 +255,7 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
child: Padding(
padding: const EdgeInsets.all(Spacing.lg),
child: Text(
'No conversations yet',
AppLocalizations.of(context)!.noConversationsYet,
style: AppTypography.bodyMediumStyle.copyWith(
color: theme.textSecondary,
),

View File

@@ -320,7 +320,7 @@ class ProfilePage extends ConsumerWidget {
(m) => m.id == settings.defaultModel,
orElse: () => models.isNotEmpty
? models.first
: const Model(id: 'none', name: 'No models available'),
: Model(id: 'none', name: AppLocalizations.of(context)!.noModelsAvailable),
);
return ListTile(
@@ -611,11 +611,14 @@ class ProfilePage extends ConsumerWidget {
),
subtitle: Text(
themeMode == ThemeMode.system
? 'Following system: '
'${platformBrightness == Brightness.dark ? 'Dark' : 'Light'}'
? AppLocalizations.of(context)!.followingSystem(
platformBrightness == Brightness.dark
? AppLocalizations.of(context)!.themeDark
: AppLocalizations.of(context)!.themeLight,
)
: (isDarkEffective
? 'Currently using Dark theme'
: 'Currently using Light theme'),
? AppLocalizations.of(context)!.currentlyUsingDarkTheme
: AppLocalizations.of(context)!.currentlyUsingLightTheme),
style: context.conduitTheme.bodySmall?.copyWith(
color: context.conduitTheme.textSecondary,
),
@@ -663,7 +666,7 @@ class ProfilePage extends ConsumerWidget {
return AlertDialog(
backgroundColor: ctx.conduitTheme.surfaceBackground,
title: Text(
'About Conduit',
AppLocalizations.of(ctx)!.aboutConduit,
style: ctx.conduitTheme.headingSmall?.copyWith(
color: ctx.conduitTheme.textPrimary,
),
@@ -673,7 +676,7 @@ class ProfilePage extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Version: ${info.version} (${info.buildNumber})',
AppLocalizations.of(ctx)!.versionLabel(info.version, info.buildNumber),
style: ctx.conduitTheme.bodyMedium?.copyWith(
color: ctx.conduitTheme.textSecondary,
),
@@ -697,7 +700,7 @@ class ProfilePage extends ConsumerWidget {
),
const SizedBox(width: Spacing.xs),
Text(
'GitHub Repository',
AppLocalizations.of(ctx)!.githubRepository,
style: ctx.conduitTheme.bodyMedium?.copyWith(
color: ctx.conduitTheme.buttonPrimary,
fontWeight: FontWeight.w600,
@@ -719,7 +722,7 @@ class ProfilePage extends ConsumerWidget {
);
} catch (e) {
if (!context.mounted) return;
UiUtils.showMessage(context, 'Unable to load app info');
UiUtils.showMessage(context, AppLocalizations.of(context)!.unableToLoadAppInfo);
}
}