l10n oath part 1

This commit is contained in:
Dennis Fokin 2022-09-01 15:07:09 +02:00
parent 46e5f70c7a
commit 8fded3b869
No known key found for this signature in database
GPG Key ID: 870B88256690D8BC
3 changed files with 40 additions and 16 deletions

View File

@ -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...",

View File

@ -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,

View File

@ -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);