mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-23 00:57:26 +03:00
Merge PR #177
This commit is contained in:
commit
f757891516
3
l10n.yaml
Normal file
3
l10n.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
arb-dir: lib/l10n
|
||||||
|
template-arb-file: app_en.arb
|
||||||
|
output-localization-file: app_localizations.dart
|
@ -1,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import '../theme.dart';
|
import '../theme.dart';
|
||||||
@ -22,6 +24,15 @@ class YubicoAuthenticatorApp extends ConsumerWidget {
|
|||||||
themeMode: ref.watch(themeModeProvider),
|
themeMode: ref.watch(themeModeProvider),
|
||||||
home: page,
|
home: page,
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
|
localizationsDelegates: const [
|
||||||
|
AppLocalizations.delegate,
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
],
|
||||||
|
supportedLocales: const [
|
||||||
|
Locale('en', ''), // English, no country code
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import '../../desktop/models.dart';
|
import '../../desktop/models.dart';
|
||||||
@ -42,15 +43,18 @@ class AppFailurePage extends ConsumerWidget {
|
|||||||
!ref.watch(rpcStateProvider.select((state) => state.isAdmin))) {
|
!ref.watch(rpcStateProvider.select((state) => state.isAdmin))) {
|
||||||
graphic = noPermission;
|
graphic = noPermission;
|
||||||
header = null;
|
header = null;
|
||||||
message = 'WebAuthn management requires elevated privileges.';
|
message = AppLocalizations.of(context)!.appFailurePage_txt_info;
|
||||||
actions = [
|
actions = [
|
||||||
OutlinedButton.icon(
|
OutlinedButton.icon(
|
||||||
label: const Text('Unlock'),
|
label: Text(AppLocalizations.of(context)!
|
||||||
|
.appFailurePage_btn_unlock),
|
||||||
icon: const Icon(Icons.lock_open),
|
icon: const Icon(Icons.lock_open),
|
||||||
style: AppTheme.primaryOutlinedButtonStyle(context),
|
style: AppTheme.primaryOutlinedButtonStyle(context),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final closeMessage = showMessage(
|
final closeMessage = showMessage(
|
||||||
context, 'Elevating permissions...',
|
context,
|
||||||
|
AppLocalizations.of(context)!
|
||||||
|
.appFailurePage_msg_permission,
|
||||||
duration: const Duration(seconds: 30));
|
duration: const Duration(seconds: 30));
|
||||||
try {
|
try {
|
||||||
if (await ref.read(rpcProvider).elevate()) {
|
if (await ref.read(rpcProvider).elevate()) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import '../../management/views/management_screen.dart';
|
import '../../management/views/management_screen.dart';
|
||||||
@ -74,7 +75,8 @@ class MainPageDrawer extends ConsumerWidget {
|
|||||||
Application.management.getAvailability(data) ==
|
Application.management.getAvailability(data) ==
|
||||||
Availability.enabled) ...[
|
Availability.enabled) ...[
|
||||||
DrawerItem(
|
DrawerItem(
|
||||||
titleText: 'Toggle applications',
|
titleText:
|
||||||
|
AppLocalizations.of(context)!.mainDrawer_txt_applications,
|
||||||
icon: Icon(Application.management._icon),
|
icon: Icon(Application.management._icon),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (shouldPop) Navigator.of(context).pop();
|
if (shouldPop) Navigator.of(context).pop();
|
||||||
@ -89,7 +91,7 @@ class MainPageDrawer extends ConsumerWidget {
|
|||||||
],
|
],
|
||||||
// Non-YubiKey pages
|
// Non-YubiKey pages
|
||||||
DrawerItem(
|
DrawerItem(
|
||||||
titleText: 'Settings',
|
titleText: AppLocalizations.of(context)!.mainDrawer_txt_settings,
|
||||||
icon: const Icon(Icons.settings),
|
icon: const Icon(Icons.settings),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final nav = Navigator.of(context);
|
final nav = Navigator.of(context);
|
||||||
@ -102,7 +104,7 @@ class MainPageDrawer extends ConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
DrawerItem(
|
DrawerItem(
|
||||||
titleText: 'Help and about',
|
titleText: AppLocalizations.of(context)!.mainDrawer_txt_help,
|
||||||
icon: const Icon(Icons.help),
|
icon: const Icon(Icons.help),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final nav = Navigator.of(context);
|
final nav = Navigator.of(context);
|
||||||
|
10
lib/l10n/app_en.arb
Normal file
10
lib/l10n/app_en.arb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"@@locale": "en",
|
||||||
|
"appFailurePage_btn_unlock": "Unlock",
|
||||||
|
"appFailurePage_txt_info": "WebAuthn management requires elevated privileges.",
|
||||||
|
"appFailurePage_msg_permission": "Elevating permissions...",
|
||||||
|
|
||||||
|
"mainDrawer_txt_applications": "Toggle applications",
|
||||||
|
"mainDrawer_txt_settings": "Settings",
|
||||||
|
"mainDrawer_txt_help": "Help and about"
|
||||||
|
}
|
12
pubspec.lock
12
pubspec.lock
@ -221,6 +221,11 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.1"
|
||||||
|
flutter_localizations:
|
||||||
|
dependency: "direct main"
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
flutter_riverpod:
|
flutter_riverpod:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -297,6 +302,13 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
intl:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: intl
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.17.0"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -32,6 +32,9 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_localizations:
|
||||||
|
sdk: flutter
|
||||||
|
intl: ^0.17.0
|
||||||
|
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
@ -75,6 +78,7 @@ dev_dependencies:
|
|||||||
# The following section is specific to Flutter.
|
# The following section is specific to Flutter.
|
||||||
flutter:
|
flutter:
|
||||||
|
|
||||||
|
generate: true
|
||||||
# The following line ensures that the Material Icons font is
|
# The following line ensures that the Material Icons font is
|
||||||
# included with your application, so that you can use the icons in
|
# included with your application, so that you can use the icons in
|
||||||
# the material Icons class.
|
# the material Icons class.
|
||||||
|
Loading…
Reference in New Issue
Block a user