mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-29 12:22:52 +03:00
l10n fido part 1
This commit is contained in:
parent
05d01bb99b
commit
32527e9384
@ -3,6 +3,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:yubico_authenticator/app/logging.dart';
|
||||
@ -111,12 +112,12 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
|
||||
|
||||
String _getMessage() {
|
||||
if (_samples == 0) {
|
||||
return 'Press your finger against the YubiKey to begin.';
|
||||
return AppLocalizations.of(context)!.fido_press_fingerprint_begin;
|
||||
}
|
||||
if (_fingerprint == null) {
|
||||
return 'Keep touching your YubiKey repeatedly...';
|
||||
return AppLocalizations.of(context)!.fido_keep_touching_yubikey;
|
||||
} else {
|
||||
return 'Fingerprint captured successfully!';
|
||||
return AppLocalizations.of(context)!.fido_fingerprint_captured;
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +128,8 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
|
||||
.renameFingerprint(_fingerprint!, _label);
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).pop(true);
|
||||
showMessage(context, 'Fingerprint added');
|
||||
showMessage(
|
||||
context, AppLocalizations.of(context)!.fido_fingerprint_added);
|
||||
} catch (e) {
|
||||
final String errorMessage;
|
||||
// TODO: Make this cleaner than importing desktop specific RpcError.
|
||||
@ -138,7 +140,7 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
|
||||
}
|
||||
showMessage(
|
||||
context,
|
||||
'Error setting name: $errorMessage',
|
||||
'${AppLocalizations.of(context)!.fido_error_setting_name}: $errorMessage',
|
||||
duration: const Duration(seconds: 4),
|
||||
);
|
||||
}
|
||||
@ -149,11 +151,11 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
|
||||
final progress = _samples == 0 ? 0.0 : _samples / (_samples + _remaining);
|
||||
|
||||
return ResponsiveDialog(
|
||||
title: const Text('Add fingerprint'),
|
||||
title: Text(AppLocalizations.of(context)!.fido_add_fingerprint),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('Step 1/2: Capture fingerprint'),
|
||||
Text(AppLocalizations.of(context)!.fido_step_1_2),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
@ -176,7 +178,7 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
|
||||
),
|
||||
],
|
||||
),
|
||||
const Text('Step 2/2: Name fingerprint'),
|
||||
Text(AppLocalizations.of(context)!.fido_step_2_2),
|
||||
TextFormField(
|
||||
focusNode: _nameFocus,
|
||||
maxLength: 15,
|
||||
@ -186,7 +188,7 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
|
||||
decoration: InputDecoration(
|
||||
enabled: _fingerprint != null,
|
||||
border: const OutlineInputBorder(),
|
||||
labelText: 'Name',
|
||||
labelText: AppLocalizations.of(context)!.fido_name,
|
||||
prefixIcon: const Icon(Icons.fingerprint_outlined),
|
||||
),
|
||||
onChanged: (value) {
|
||||
@ -211,7 +213,7 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: _fingerprint != null && _label.isNotEmpty ? _submit : null,
|
||||
child: const Text('Save'),
|
||||
child: Text(AppLocalizations.of(context)!.fido_save),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -1,6 +1,7 @@
|
||||
// ignore_for_file: sort_child_properties_last
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../app/message.dart';
|
||||
@ -20,12 +21,12 @@ class DeleteCredentialDialog extends ConsumerWidget {
|
||||
final label = credential.userName;
|
||||
|
||||
return ResponsiveDialog(
|
||||
title: const Text('Delete credential'),
|
||||
title: Text(AppLocalizations.of(context)!.fido_delete_credential),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('This will delete the credential from your YubiKey.'),
|
||||
Text('Credential: $label'),
|
||||
Text(AppLocalizations.of(context)!.fido_this_will_delete_cred),
|
||||
Text('${AppLocalizations.of(context)!.fido_credential}: $label'),
|
||||
]
|
||||
.map((e) => Padding(
|
||||
child: e,
|
||||
@ -42,11 +43,12 @@ class DeleteCredentialDialog extends ConsumerWidget {
|
||||
await ref.read(withContextProvider)(
|
||||
(context) async {
|
||||
Navigator.of(context).pop(true);
|
||||
showMessage(context, 'Credential deleted');
|
||||
showMessage(context,
|
||||
AppLocalizations.of(context)!.fido_credential_deleted);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Text('Delete'),
|
||||
child: Text(AppLocalizations.of(context)!.fido_delete),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -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/message.dart';
|
||||
@ -18,7 +19,7 @@ class DeleteFingerprintDialog extends ConsumerWidget {
|
||||
final label = fingerprint.label;
|
||||
|
||||
return ResponsiveDialog(
|
||||
title: const Text('Delete fingerprint'),
|
||||
title: Text(AppLocalizations.of(context)!.fido_delete_fingerprint),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
@ -27,17 +28,18 @@ class DeleteFingerprintDialog extends ConsumerWidget {
|
||||
.deleteFingerprint(fingerprint);
|
||||
await ref.read(withContextProvider)((context) async {
|
||||
Navigator.of(context).pop(true);
|
||||
showMessage(context, 'Fingerprint deleted');
|
||||
showMessage(context,
|
||||
AppLocalizations.of(context)!.fido_fingerprint_deleted);
|
||||
});
|
||||
},
|
||||
child: const Text('Delete'),
|
||||
child: Text(AppLocalizations.of(context)!.fido_delete),
|
||||
),
|
||||
],
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('This will delete the fingerprint from your YubiKey.'),
|
||||
Text('Fingerprint: $label'),
|
||||
Text(AppLocalizations.of(context)!.fido_this_will_delete_fp),
|
||||
Text('${AppLocalizations.of(context)!.fido_fingerprint}: $label'),
|
||||
]
|
||||
.map((e) => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
|
@ -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';
|
||||
@ -20,7 +21,7 @@ class FidoScreen extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) =>
|
||||
ref.watch(fidoStateProvider(deviceData.node.path)).when(
|
||||
loading: () => AppPage(
|
||||
title: const Text('WebAuthn'),
|
||||
title: Text(AppLocalizations.of(context)!.fido_webauthn),
|
||||
centered: true,
|
||||
child: const AppLoadingScreen(),
|
||||
),
|
||||
@ -30,26 +31,25 @@ class FidoScreen extends ConsumerWidget {
|
||||
0;
|
||||
if (Capability.fido2.value & supported == 0) {
|
||||
return MessagePage(
|
||||
title: const Text('WebAuthn'),
|
||||
title: Text(AppLocalizations.of(context)!.fido_webauthn),
|
||||
graphic: manageAccounts,
|
||||
header: 'Ready to use',
|
||||
message: 'Register as a Security Key on websites',
|
||||
header: AppLocalizations.of(context)!.fido_ready_to_use,
|
||||
message: AppLocalizations.of(context)!.fido_register_as_a_key,
|
||||
);
|
||||
}
|
||||
final enabled = deviceData.info.config
|
||||
.enabledCapabilities[deviceData.node.transport] ??
|
||||
0;
|
||||
if (Capability.fido2.value & enabled == 0) {
|
||||
return const MessagePage(
|
||||
title: Text('WebAuthn'),
|
||||
header: 'FIDO2 disabled',
|
||||
message:
|
||||
'WebAuthn requires the FIDO2 application to be enabled on your YubiKey',
|
||||
return MessagePage(
|
||||
title: Text(AppLocalizations.of(context)!.fido_webauthn),
|
||||
header: AppLocalizations.of(context)!.fido_fido_disabled,
|
||||
message: AppLocalizations.of(context)!.fido_webauthn_req_fido,
|
||||
);
|
||||
}
|
||||
|
||||
return AppFailurePage(
|
||||
title: const Text('WebAuthn'),
|
||||
title: Text(AppLocalizations.of(context)!.fido_webauthn),
|
||||
cause: error,
|
||||
);
|
||||
},
|
||||
|
@ -95,6 +95,38 @@
|
||||
"general_log_level_set_to": "Log level set to",
|
||||
"general_copy_log": "Copy log",
|
||||
"general_log_copied": "Log copied to clipboard",
|
||||
"general_settings": "Settings",
|
||||
"general_appearance": "Appearance",
|
||||
"general_system_default": "System default",
|
||||
"general_light_mode": "Light mode",
|
||||
"general_dark_mode": "Dark mode",
|
||||
|
||||
"fido_press_fingerprint_begin": "Press your finger against the YubiKey to begin.",
|
||||
"fido_keep_touching_yubikey": "Keep touching your YubiKey repeatedly...",
|
||||
"fido_fingerprint_captured": "Fingerprint captured successfully!",
|
||||
"fido_fingerprint_added": "Fingerprint added",
|
||||
"fido_error_setting_name": "Error setting name",
|
||||
"fido_add_fingerprint": "Add fingerprint",
|
||||
"fido_step_1_2": "Step 1/2: Capture fingerprint",
|
||||
"fido_step_2_2": "Step 2/2: Name fingerprint",
|
||||
"fido_name": "Name",
|
||||
"fido_save": "Save",
|
||||
"fido_delete_credential": "Delete credential",
|
||||
"fido_this_will_delete_cred": "This will delete the credential from your YubiKey.",
|
||||
"fido_credential": "Credential",
|
||||
"fido_credential_deleted": "Credential deleted",
|
||||
"fido_delete": "Delete",
|
||||
"fido_delete_fingerprint": "Delete fingerprint",
|
||||
"fido_fingerprint_deleted": "Fingerprint deleted",
|
||||
"fido_this_will_delete_fp": "This will delete the fingerprint from your YubiKey.",
|
||||
"fido_fingerprint": "Fingerprint",
|
||||
"fido_webauthn": "WebAuthn",
|
||||
"fido_ready_to_use": "Ready to use",
|
||||
"fido_register_as_a_key": "Register as a Security Key on websites",
|
||||
"fido_fido_disabled": "FIDO2 disabled",
|
||||
"fido_webauthn_req_fido": "WebAuthn requires the FIDO2 application to be enabled on your YubiKey",
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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 'package:logging/logging.dart';
|
||||
|
||||
@ -16,14 +17,14 @@ class SettingsPage extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final themeMode = ref.watch(themeModeProvider);
|
||||
return ResponsiveDialog(
|
||||
title: const Text('Settings'),
|
||||
title: Text(AppLocalizations.of(context)!.general_settings),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ListTitle('Appearance'),
|
||||
ListTitle(AppLocalizations.of(context)!.general_appearance),
|
||||
RadioListTile<ThemeMode>(
|
||||
title: const Text('System default'),
|
||||
title: Text(AppLocalizations.of(context)!.general_system_default),
|
||||
value: ThemeMode.system,
|
||||
groupValue: themeMode,
|
||||
onChanged: (mode) {
|
||||
@ -32,7 +33,7 @@ class SettingsPage extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
RadioListTile<ThemeMode>(
|
||||
title: const Text('Light mode'),
|
||||
title: Text(AppLocalizations.of(context)!.general_light_mode),
|
||||
value: ThemeMode.light,
|
||||
groupValue: themeMode,
|
||||
onChanged: (mode) {
|
||||
@ -41,7 +42,7 @@ class SettingsPage extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
RadioListTile<ThemeMode>(
|
||||
title: const Text('Dark mode'),
|
||||
title: Text(AppLocalizations.of(context)!.general_dark_mode),
|
||||
value: ThemeMode.dark,
|
||||
groupValue: themeMode,
|
||||
onChanged: (mode) {
|
||||
|
Loading…
Reference in New Issue
Block a user