mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 02:01:36 +03:00
l10n mgmt widgets general part 1
This commit is contained in:
parent
3290a5c65e
commit
c6227844f8
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
|
||||
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 'package:logging/logging.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@ -47,9 +48,9 @@ class AboutPage extends ConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Terms of use',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_terms_of_use,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
@ -60,9 +61,9 @@ class AboutPage extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Privacy policy',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_privacy_policy,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
@ -75,9 +76,9 @@ class AboutPage extends ConsumerWidget {
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Open source licenses',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_open_src_licenses,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(MaterialPageRoute<void>(
|
||||
@ -95,7 +96,7 @@ class AboutPage extends ConsumerWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: Text(
|
||||
'Help and feedback',
|
||||
AppLocalizations.of(context)!.general_help_and_feedback,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
@ -103,9 +104,9 @@ class AboutPage extends ConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Send us feedback',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_send_feedback,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
@ -115,9 +116,9 @@ class AboutPage extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'I need help',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_i_need_help,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class ErrorPage extends StatelessWidget {
|
||||
final String error;
|
||||
@ -8,7 +9,7 @@ class ErrorPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Application error'),
|
||||
title: Text(AppLocalizations.of(context)!.general_application_error),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
|
@ -70,6 +70,27 @@
|
||||
"oath_reset": "Reset",
|
||||
"oath_warning_will_delete_accounts": "Warning! This will irrevocably delete all OATH TOTP/HOTP accounts from your YubiKey.",
|
||||
"oath_warning_disable_these_creds": "Your OATH credentials, as well as any password set, will be removed from this YubiKey. Make sure to first disable these from their respective web sites to avoid being locked out of your accounts.",
|
||||
|
||||
"widgets_cancel": "Cancel",
|
||||
"widgets_close": "Close",
|
||||
|
||||
"mgmt_min_one_interface": "At least one interface must be enabled",
|
||||
"mgmt_reconfiguring_yubikey": "Reconfiguring YubiKey...",
|
||||
"mgmt_configuration_updated": "Configuration updated",
|
||||
"mgmt_configuration_updated_remove_reinsert": "Configuration updated, remove and reinsert your YubiKey",
|
||||
"mgmt_toggle_applications": "Toggle applications",
|
||||
"mgmt_save": "Save",
|
||||
|
||||
"general_terms_of_use": "Terms of use",
|
||||
"general_privacy_policy": "Privacy policy",
|
||||
"general_open_src_licenses": "Open source licenses",
|
||||
"general_help_and_feedback": "Help and feedback",
|
||||
"general_send_feedback": "Send us feedback",
|
||||
"general_i_need_help": "I need help",
|
||||
"general_application_error": "Application error",
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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:collection/collection.dart';
|
||||
|
||||
@ -59,7 +60,9 @@ class _ModeForm extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
Text(interfaces == 0 ? 'At least one interface must be enabled' : ''),
|
||||
Text(interfaces == 0
|
||||
? AppLocalizations.of(context)!.mgmt_min_one_interface
|
||||
: ''),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -177,7 +180,7 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
// This will take longer, show a message
|
||||
close = showMessage(
|
||||
context,
|
||||
'Reconfiguring YubiKey...',
|
||||
AppLocalizations.of(context)!.mgmt_reconfiguring_yubikey,
|
||||
duration: const Duration(seconds: 8),
|
||||
);
|
||||
}
|
||||
@ -190,7 +193,8 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (!reboot) Navigator.pop(context);
|
||||
showMessage(context, 'Configuration updated');
|
||||
showMessage(
|
||||
context, AppLocalizations.of(context)!.mgmt_configuration_updated);
|
||||
} finally {
|
||||
close?.call();
|
||||
}
|
||||
@ -214,9 +218,10 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
showMessage(
|
||||
context,
|
||||
widget.deviceData.node.maybeMap(
|
||||
nfcReader: (_) => 'Configuration updated',
|
||||
orElse: () =>
|
||||
'Configuration updated, remove and reinsert your YubiKey'));
|
||||
nfcReader: (_) =>
|
||||
AppLocalizations.of(context)!.mgmt_configuration_updated,
|
||||
orElse: () => AppLocalizations.of(context)!
|
||||
.mgmt_configuration_updated_remove_reinsert));
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
@ -272,11 +277,11 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
);
|
||||
|
||||
return ResponsiveDialog(
|
||||
title: const Text('Toggle applications'),
|
||||
title: Text(AppLocalizations.of(context)!.mgmt_toggle_applications),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: canSave ? _submitForm : null,
|
||||
child: const Text('Save'),
|
||||
child: Text(AppLocalizations.of(context)!.mgmt_save),
|
||||
),
|
||||
],
|
||||
child: child,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class ResponsiveDialog extends StatefulWidget {
|
||||
final Widget? title;
|
||||
@ -44,8 +45,8 @@ class _ResponsiveDialogState extends State<ResponsiveDialog> {
|
||||
} else {
|
||||
// Dialog
|
||||
final cancelText = widget.onCancel == null && widget.actions.isEmpty
|
||||
? 'Close'
|
||||
: 'Cancel';
|
||||
? AppLocalizations.of(context)!.widgets_close
|
||||
: AppLocalizations.of(context)!.widgets_cancel;
|
||||
return AlertDialog(
|
||||
title: widget.title,
|
||||
scrollable: true,
|
||||
|
Loading…
Reference in New Issue
Block a user