From 8fded3b869d67db87bd98ca3f3ab2a1e588f4c74 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Thu, 1 Sep 2022 15:07:09 +0200 Subject: [PATCH] l10n oath part 1 --- lib/l10n/app_en.arb | 13 +++++++++++++ lib/oath/views/account_list.dart | 11 +++++++---- lib/oath/views/account_mixin.dart | 32 +++++++++++++++++++------------ 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index ed169241..33674b43 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1,5 +1,18 @@ { "@@locale": "en", + "oath_no_credentials": "No credentials", + "oath_pinned": "Pinned", + "oath_accounts": "Accounts", + "oath_copied_to_clipboard": "Code copied to clipboard", + "oath_copy_to_clipboard": "Copy to clipboard", + "oath_calculate": "Calculate", + "oath_pin_account": "Pin account", + "oath_unpin_account": "Unpin account", + "oath_rename_account": "Rename account", + "oath_delete_account": "Delete account", + + + "appFailurePage_btn_unlock": "Unlock", "appFailurePage_txt_info": "WebAuthn management requires elevated privileges.", "appFailurePage_msg_permission": "Elevating permissions...", diff --git a/lib/oath/views/account_list.dart b/lib/oath/views/account_list.dart index 717d4c48..c2ab9700 100755 --- a/lib/oath/views/account_list.dart +++ b/lib/oath/views/account_list.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../app/models.dart'; @@ -26,8 +27,8 @@ class AccountList extends ConsumerWidget { final credentials = ref.watch(filteredCredentialsProvider(accounts)); final favorites = ref.watch(favoritesProvider); if (credentials.isEmpty) { - return const Center( - child: Text('No credentials'), + return Center( + child: Text(AppLocalizations.of(context)!.oath_no_credentials), ); } @@ -40,13 +41,15 @@ class AccountList extends ConsumerWidget { policy: WidgetOrderTraversalPolicy(), child: Column( children: [ - if (pinnedCreds.isNotEmpty) const ListTitle('Pinned'), + if (pinnedCreds.isNotEmpty) + ListTitle(AppLocalizations.of(context)!.oath_pinned), ...pinnedCreds.map( (entry) => AccountView( entry.credential, ), ), - if (creds.isNotEmpty) const ListTitle('Accounts'), + if (creds.isNotEmpty) + ListTitle(AppLocalizations.of(context)!.oath_accounts), ...creds.map( (entry) => AccountView( entry.credential, diff --git a/lib/oath/views/account_mixin.dart b/lib/oath/views/account_mixin.dart index 9e6e3ae6..9cf29204 100755 --- a/lib/oath/views/account_mixin.dart +++ b/lib/oath/views/account_mixin.dart @@ -4,6 +4,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../app/message.dart'; @@ -70,7 +71,8 @@ mixin AccountMixin { void copyToClipboard(BuildContext context, OathCode? code) { if (code != null) { Clipboard.setData(ClipboardData(text: code.value)); - showMessage(context, 'Code copied to clipboard'); + showMessage( + context, AppLocalizations.of(context)!.oath_copied_to_clipboard); } } @@ -108,31 +110,37 @@ mixin AccountMixin { final shortcut = Platform.isMacOS ? '\u2318 C' : 'Ctrl+C'; return [ MenuAction( - text: 'Copy to clipboard ($shortcut)', + text: + '${AppLocalizations.of(context)!.oath_copy_to_clipboard} ($shortcut)', icon: const Icon(Icons.copy), action: code == null || expired ? null : (context) { Clipboard.setData(ClipboardData(text: code.value)); - showMessage(context, 'Code copied to clipboard'); + showMessage( + context, + AppLocalizations.of(context)! + .oath_copied_to_clipboard); }, ), if (manual) MenuAction( - text: 'Calculate', + text: AppLocalizations.of(context)!.oath_calculate, icon: const Icon(Icons.refresh), action: ready ? (context) async { - try { - await calculateCode(context, ref); - } on CancellationException catch (_) { - // ignored + try { + await calculateCode(context, ref); + } on CancellationException catch (_) { + // ignored + } } - } : null, ), MenuAction( - text: pinned ? 'Unpin account' : 'Pin account', + text: pinned + ? AppLocalizations.of(context)!.oath_unpin_account + : AppLocalizations.of(context)!.oath_pin_account, icon: pinned ? pushPinStrokeIcon : const Icon(Icons.push_pin_outlined), @@ -145,13 +153,13 @@ mixin AccountMixin { if (data.info.version.isAtLeast(5, 3)) MenuAction( icon: const Icon(Icons.edit_outlined), - text: 'Rename account', + text: AppLocalizations.of(context)!.oath_rename_account, action: (context) async { await renameCredential(context, ref); }, ), MenuAction( - text: 'Delete account', + text: AppLocalizations.of(context)!.oath_delete_account, icon: const Icon(Icons.delete_outline), action: (context) async { await deleteCredential(context, ref);