From 1d3d2c98df1ae805fc297ec1d66accc2233550c6 Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Thu, 4 Nov 2021 16:37:39 -0400 Subject: [PATCH 1/2] fix: resend signup code --- .../amplify_authenticator/lib/src/state/auth_viewmodel.dart | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/amplify_authenticator/lib/src/state/auth_viewmodel.dart b/packages/amplify_authenticator/lib/src/state/auth_viewmodel.dart index ab82387ba4..fefd954e86 100644 --- a/packages/amplify_authenticator/lib/src/state/auth_viewmodel.dart +++ b/packages/amplify_authenticator/lib/src/state/auth_viewmodel.dart @@ -337,15 +337,10 @@ class AuthViewModel extends ChangeNotifier { } Future resendSignUpCode() async { - if (!_formKey.currentState!.validate()) { - return; - } - setBusy(true); authBloc.add(AuthResendSignUpCode(_username)); await _nextBlocEvent( where: (state) => state is VerificationCodeSent, ); - setBusy(false); } Future confirmVerifyUser(String userAttributeKey) async { From 8c373c25c66a2375aafcacba06913fbd0c9d3bf3 Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Fri, 5 Nov 2021 10:48:07 -0400 Subject: [PATCH 2/2] feat: display message after resendSignUpCode --- .../lib/amplify_authenticator.dart | 34 +++- .../lib/src/blocs/auth/auth_bloc.dart | 32 +++- .../lib/src/l10n/auth_strings_resolver.dart | 8 +- .../src/l10n/authenticator_localizations.dart | 9 + .../l10n/generated/message_localizations.dart | 160 ++++++++++++++++++ .../generated/message_localizations_en.dart | 35 ++++ .../lib/src/l10n/message_resolver.dart | 38 +++++ .../lib/src/l10n/src/inputs/inputs_en.arb | 4 +- .../lib/src/l10n/src/messages/messages_en.arb | 16 ++ .../lib/src/l10n/string_resolver.dart | 18 ++ ..._banner.dart => authenticator_banner.dart} | 0 .../tool/generate_l10n.sh | 8 +- 12 files changed, 350 insertions(+), 12 deletions(-) create mode 100644 packages/amplify_authenticator/lib/src/l10n/generated/message_localizations.dart create mode 100644 packages/amplify_authenticator/lib/src/l10n/generated/message_localizations_en.dart create mode 100644 packages/amplify_authenticator/lib/src/l10n/message_resolver.dart create mode 100644 packages/amplify_authenticator/lib/src/l10n/src/messages/messages_en.arb create mode 100644 packages/amplify_authenticator/lib/src/l10n/string_resolver.dart rename packages/amplify_authenticator/lib/src/widgets/{exception_banner.dart => authenticator_banner.dart} (100%) diff --git a/packages/amplify_authenticator/lib/amplify_authenticator.dart b/packages/amplify_authenticator/lib/amplify_authenticator.dart index b6d7bca179..96d24170f0 100644 --- a/packages/amplify_authenticator/lib/amplify_authenticator.dart +++ b/packages/amplify_authenticator/lib/amplify_authenticator.dart @@ -22,6 +22,7 @@ import 'package:amplify_authenticator/src/enums/enums.dart'; import 'package:amplify_authenticator/src/keys.dart'; import 'package:amplify_authenticator/src/l10n/auth_strings_resolver.dart'; import 'package:amplify_authenticator/src/l10n/authenticator_localizations.dart'; +import 'package:amplify_authenticator/src/l10n/string_resolver.dart'; import 'package:amplify_authenticator/src/models/authenticator_exception.dart'; import 'package:amplify_authenticator/src/screens/authenticator_screen.dart'; import 'package:amplify_authenticator/src/screens/loading_screen.dart'; @@ -33,7 +34,7 @@ import 'package:amplify_authenticator/src/state/inherited_config.dart'; import 'package:amplify_authenticator/src/state/inherited_forms.dart'; import 'package:amplify_authenticator/src/state/inherited_strings.dart'; import 'package:amplify_authenticator/src/theme/amplify_theme.dart'; -import 'package:amplify_authenticator/src/widgets/exception_banner.dart'; +import 'package:amplify_authenticator/src/widgets/authenticator_banner.dart'; import 'package:amplify_authenticator/src/widgets/form.dart'; import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/src/config/amplify_config.dart'; @@ -197,6 +198,7 @@ class _AuthenticatorState extends State { late final StateMachineBloc _stateMachineBloc; late final AuthViewModel _viewModel; late final StreamSubscription _exceptionSub; + late final StreamSubscription _infoSub; AmplifyConfig? _config; late List _missingConfigValues; bool _configInitialized = false; @@ -204,9 +206,13 @@ class _AuthenticatorState extends State { @override void initState() { super.initState(); - _stateMachineBloc = StateMachineBloc(_authService)..add(const AuthLoad()); + _stateMachineBloc = StateMachineBloc( + authService: _authService, + authStringResolver: widget.stringResolver, + )..add(const AuthLoad()); _viewModel = AuthViewModel(_stateMachineBloc); _subscribeToExceptions(); + _subscribeToInfoMessages(); _waitForConfiguration(); } @@ -235,9 +241,31 @@ class _AuthenticatorState extends State { }); } + void _subscribeToInfoMessages() { + _infoSub = _stateMachineBloc.infoMessages.listen((resolver) { + if (mounted) { + ScaffoldMessenger.of(context) + ..clearMaterialBanners() + ..showMaterialBanner(createMaterialBanner( + type: StatusType.info, + content: Text(resolver(context)), + margin: MediaQuery.of(context).viewPadding.top, + actions: [ + IconButton( + onPressed: () => + ScaffoldMessenger.of(context).clearMaterialBanners(), + icon: const Icon(Icons.close), + ), + ], + )); + } + }); + } + @override void dispose() { _exceptionSub.cancel(); + _infoSub.cancel(); _stateMachineBloc.dispose(); super.dispose(); } @@ -308,7 +336,7 @@ class _AuthenticatorState extends State { } class _AuthenticatorBody extends StatelessWidget { - _AuthenticatorBody({ + const _AuthenticatorBody({ Key? key, required this.child, }) : super(key: key); diff --git a/packages/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index fc92462e35..d4588932a0 100644 --- a/packages/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -18,6 +18,7 @@ import 'dart:async'; import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_authenticator/amplify_authenticator.dart'; import 'package:amplify_authenticator/src/blocs/auth/auth_data.dart'; +import 'package:amplify_authenticator/src/l10n/string_resolver.dart'; import 'package:amplify_authenticator/src/services/amplify_auth_service.dart'; import 'package:amplify_flutter/amplify.dart'; import 'package:amplify_flutter/src/config/amplify_config.dart'; @@ -32,6 +33,7 @@ part 'auth_state.dart'; /// {@endtemplate} class StateMachineBloc { final AuthService _authService; + final AuthStringResolver _authStringResolver; /// State controller. final StreamController _authStateController = @@ -58,7 +60,11 @@ class StateMachineBloc { AuthState get currentState => _currentState; /// {@macro authenticator.state_machine_bloc} - StateMachineBloc(this._authService) { + StateMachineBloc({ + required AuthService authService, + required AuthStringResolver authStringResolver, + }) : _authService = authService, + _authStringResolver = authStringResolver { _subscription = _authEventStream.asyncExpand(_eventTransformer).listen((state) { _controllerSink.add(state); @@ -78,6 +84,13 @@ class StateMachineBloc { /// Exception events which occur in the bloc. Stream get exceptions => _exceptionController.stream; + /// Manages info messages separate from the bloc's state. + final StreamController _infoMessageController = + StreamController.broadcast(); + + /// Info messages generated from the bloc. + Stream get infoMessages => _infoMessageController.stream; + Stream _eventTransformer(AuthEvent event) async* { if (event is AuthLoad) { yield* _authLoad(); @@ -375,7 +388,22 @@ class StateMachineBloc { Stream _resendSignUpCode(String username) async* { try { - await _authService.resendSignUpCode(username); + ResendSignUpCodeResult result = + await _authService.resendSignUpCode(username); + String? deliveryMedium = result.codeDeliveryDetails.deliveryMedium; + switch (deliveryMedium) { + case 'EMAIL': + _infoMessageController + .add(_authStringResolver.messages.codeSentEmail); + break; + case 'SMS': + _infoMessageController.add(_authStringResolver.messages.codeSentSMS); + break; + default: + _infoMessageController.add( + _authStringResolver.messages.codeSentUnknown, + ); + } yield VerificationCodeSent((_currentState as AuthFlow).screen); } on AmplifyException catch (e) { _exceptionController.add(AuthenticatorException(e.message)); diff --git a/packages/amplify_authenticator/lib/src/l10n/auth_strings_resolver.dart b/packages/amplify_authenticator/lib/src/l10n/auth_strings_resolver.dart index 69590d47ad..0805cf89e7 100644 --- a/packages/amplify_authenticator/lib/src/l10n/auth_strings_resolver.dart +++ b/packages/amplify_authenticator/lib/src/l10n/auth_strings_resolver.dart @@ -17,6 +17,7 @@ import 'package:flutter/material.dart'; import 'button_resolver.dart'; import 'input_resolver.dart'; +import 'message_resolver.dart'; import 'title_resolver.dart'; export 'button_resolver.dart'; @@ -40,14 +41,19 @@ class AuthStringResolver { /// The resolver class for titles final TitleResolver titles; + /// The resolver class for titles + final MessageResolver messages; + /// {@macro authenticator.auth_string_resolver} const AuthStringResolver({ ButtonResolver? buttons, InputResolver? inputs, TitleResolver? titles, + MessageResolver? messages, }) : titles = titles ?? const TitleResolver(), buttons = buttons ?? const ButtonResolver(), - inputs = inputs ?? const InputResolver(); + inputs = inputs ?? const InputResolver(), + messages = messages ?? const MessageResolver(); @override bool operator ==(Object other) => diff --git a/packages/amplify_authenticator/lib/src/l10n/authenticator_localizations.dart b/packages/amplify_authenticator/lib/src/l10n/authenticator_localizations.dart index 2c350c9665..64707b3d4f 100644 --- a/packages/amplify_authenticator/lib/src/l10n/authenticator_localizations.dart +++ b/packages/amplify_authenticator/lib/src/l10n/authenticator_localizations.dart @@ -15,6 +15,7 @@ import 'package:amplify_authenticator/src/l10n/generated/button_localizations_en.dart'; import 'package:amplify_authenticator/src/l10n/generated/input_localizations_en.dart'; +import 'package:amplify_authenticator/src/l10n/generated/message_localizations_en.dart'; import 'package:amplify_authenticator/src/l10n/generated/title_localizations_en.dart'; import 'package:flutter/material.dart'; @@ -22,6 +23,7 @@ import 'package:flutter_localizations/flutter_localizations.dart'; import 'generated/button_localizations.dart'; import 'generated/input_localizations.dart'; +import 'generated/message_localizations.dart'; import 'generated/title_localizations.dart'; /// Reference class for all Authenticator localizations. @@ -41,6 +43,7 @@ abstract class AuthenticatorLocalizations { static final _buttonsFallback = AuthenticatorButtonLocalizationsEn(); static final _inputsFallback = AuthenticatorInputLocalizationsEn(); static final _titlesFallback = AuthenticatorTitleLocalizationsEn(); + static final _messagesFallback = AuthenticatorMessageLocalizationsEn(); /// Retrieves the [AuthenticatorButtonLocalizations] instance, falling back /// to English if unavailable for this locale. @@ -59,4 +62,10 @@ abstract class AuthenticatorLocalizations { static AuthenticatorTitleLocalizations titlesOf(BuildContext context) { return AuthenticatorTitleLocalizations.of(context) ?? _titlesFallback; } + + /// Retrieves the [AuthenticatorMessageLocalizations] instance, falling back + /// to English if unavailable for this locale. + static AuthenticatorMessageLocalizations messagesOf(BuildContext context) { + return AuthenticatorMessageLocalizations.of(context) ?? _messagesFallback; + } } diff --git a/packages/amplify_authenticator/lib/src/l10n/generated/message_localizations.dart b/packages/amplify_authenticator/lib/src/l10n/generated/message_localizations.dart new file mode 100644 index 0000000000..5e38c69196 --- /dev/null +++ b/packages/amplify_authenticator/lib/src/l10n/generated/message_localizations.dart @@ -0,0 +1,160 @@ +/* + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import 'dart:async'; + +import 'package:flutter/widgets.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:intl/intl.dart' as intl; + +import 'message_localizations_en.dart' deferred as message_localizations_en; + +/// Callers can lookup localized strings with an instance of AuthenticatorMessageLocalizations returned +/// by `AuthenticatorMessageLocalizations.of(context)`. +/// +/// Applications need to include `AuthenticatorMessageLocalizations.delegate()` in their app's +/// localizationDelegates list, and the locales they support in the app's +/// supportedLocales list. For example: +/// +/// ``` +/// import 'generated/message_localizations.dart'; +/// +/// return MaterialApp( +/// localizationsDelegates: AuthenticatorMessageLocalizations.localizationsDelegates, +/// supportedLocales: AuthenticatorMessageLocalizations.supportedLocales, +/// home: MyApplicationHome(), +/// ); +/// ``` +/// +/// ## Update pubspec.yaml +/// +/// Please make sure to update your pubspec.yaml to include the following +/// packages: +/// +/// ``` +/// dependencies: +/// # Internationalization support. +/// flutter_localizations: +/// sdk: flutter +/// intl: any # Use the pinned version from flutter_localizations +/// +/// # rest of dependencies +/// ``` +/// +/// ## iOS Applications +/// +/// iOS applications define key application metadata, including supported +/// locales, in an Info.plist file that is built into the application bundle. +/// To configure the locales supported by your app, you’ll need to edit this +/// file. +/// +/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file. +/// Then, in the Project Navigator, open the Info.plist file under the Runner +/// project’s Runner folder. +/// +/// Next, select the Information Property List item, select Add Item from the +/// Editor menu, then select Localizations from the pop-up menu. +/// +/// Select and expand the newly-created Localizations item then, for each +/// locale your application supports, add a new item and select the locale +/// you wish to add from the pop-up menu in the Value field. This list should +/// be consistent with the languages listed in the AuthenticatorMessageLocalizations.supportedLocales +/// property. +abstract class AuthenticatorMessageLocalizations { + AuthenticatorMessageLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + + final String localeName; + + static AuthenticatorMessageLocalizations? of(BuildContext context) { + return Localizations.of( + context, AuthenticatorMessageLocalizations); + } + + static const LocalizationsDelegate + delegate = _AuthenticatorMessageLocalizationsDelegate(); + + /// A list of this localizations delegate along with the default localizations + /// delegates. + /// + /// Returns a list of localizations delegates containing this delegate along with + /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, + /// and GlobalWidgetsLocalizations.delegate. + /// + /// Additional delegates can be added by appending to this list in + /// MaterialApp. This list does not have to be used at all if a custom list + /// of delegates is preferred or required. + static const List> localizationsDelegates = + >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; + + /// A list of this localizations delegate's supported locales. + static const List supportedLocales = [Locale('en')]; + + /// The message that is displayed after a new confirmation code is sent via email + /// + /// In en, this message translates to: + /// **'A new confirmation code has been sent to the email associated with this account.'** + String get codeSentEmail; + + /// The message that is displayed after a new confirmation code is sent via SMS + /// + /// In en, this message translates to: + /// **'A new confirmation code has been sent to the phone number associated with this account.'** + String get codeSentSMS; + + /// The message that is displayed after a new confirmation code is sent via an unknown delivery medium + /// + /// In en, this message translates to: + /// **'A new confirmation code has been sent.'** + String get codeSentUnknown; +} + +class _AuthenticatorMessageLocalizationsDelegate + extends LocalizationsDelegate { + const _AuthenticatorMessageLocalizationsDelegate(); + + @override + Future load(Locale locale) { + return lookupAuthenticatorMessageLocalizations(locale); + } + + @override + bool isSupported(Locale locale) => + ['en'].contains(locale.languageCode); + + @override + bool shouldReload(_AuthenticatorMessageLocalizationsDelegate old) => false; +} + +Future + lookupAuthenticatorMessageLocalizations(Locale locale) { + // Lookup logic when only language code is specified. + switch (locale.languageCode) { + case 'en': + return message_localizations_en.loadLibrary().then((dynamic _) => + message_localizations_en.AuthenticatorMessageLocalizationsEn()); + } + + throw FlutterError( + 'AuthenticatorMessageLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.'); +} diff --git a/packages/amplify_authenticator/lib/src/l10n/generated/message_localizations_en.dart b/packages/amplify_authenticator/lib/src/l10n/generated/message_localizations_en.dart new file mode 100644 index 0000000000..b20b51b984 --- /dev/null +++ b/packages/amplify_authenticator/lib/src/l10n/generated/message_localizations_en.dart @@ -0,0 +1,35 @@ +/* + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import 'package:amplify_authenticator/amplify_authenticator.dart'; + +import 'message_localizations.dart'; + +/// The translations for English (`en`). +class AuthenticatorMessageLocalizationsEn + extends AuthenticatorMessageLocalizations { + AuthenticatorMessageLocalizationsEn([String locale = 'en']) : super(locale); + + @override + String get codeSentEmail => + 'A new confirmation code has been sent to the email associated with this account.'; + + @override + String get codeSentSMS => + 'A new confirmation code has been sent to the phone number associated with this account.'; + + @override + String get codeSentUnknown => 'A new confirmation code has been sent.'; +} diff --git a/packages/amplify_authenticator/lib/src/l10n/message_resolver.dart b/packages/amplify_authenticator/lib/src/l10n/message_resolver.dart new file mode 100644 index 0000000000..7654413cd9 --- /dev/null +++ b/packages/amplify_authenticator/lib/src/l10n/message_resolver.dart @@ -0,0 +1,38 @@ +/* + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import 'package:flutter/material.dart'; + +import 'authenticator_localizations.dart'; + +/// The resolver class for messages +class MessageResolver { + const MessageResolver(); + + /// The message that is displayed after a new confirmation code is sent via email. + String codeSentEmail(BuildContext context) { + return AuthenticatorLocalizations.messagesOf(context).codeSentEmail; + } + + /// The message that is displayed after a new confirmation code is sent via SMS. + String codeSentSMS(BuildContext context) { + return AuthenticatorLocalizations.messagesOf(context).codeSentSMS; + } + + /// The message that is displayed after a new confirmation code is sent via an unknown delivery medium. + String codeSentUnknown(BuildContext context) { + return AuthenticatorLocalizations.messagesOf(context).codeSentUnknown; + } +} diff --git a/packages/amplify_authenticator/lib/src/l10n/src/inputs/inputs_en.arb b/packages/amplify_authenticator/lib/src/l10n/src/inputs/inputs_en.arb index a4e3bf5b84..3b0438e012 100644 --- a/packages/amplify_authenticator/lib/src/l10n/src/inputs/inputs_en.arb +++ b/packages/amplify_authenticator/lib/src/l10n/src/inputs/inputs_en.arb @@ -156,9 +156,9 @@ "rememberDevice": "Remember Device?", "@rememberDevice": { "description": "Label for the checkbox to remember the user's device in Cognito." - } + }, "usernameType": "Select what you want to use as a username", - "@rememberDevice": { + "@usernameType": { "description": " Label for the radio button set to select email or phone number as username when both are available." } } \ No newline at end of file diff --git a/packages/amplify_authenticator/lib/src/l10n/src/messages/messages_en.arb b/packages/amplify_authenticator/lib/src/l10n/src/messages/messages_en.arb new file mode 100644 index 0000000000..b8d84a9131 --- /dev/null +++ b/packages/amplify_authenticator/lib/src/l10n/src/messages/messages_en.arb @@ -0,0 +1,16 @@ +{ + "@@locale": "en", + "@@context": "amplify_authenticator:messages", + "codeSentEmail": "A new confirmation code has been sent to the email associated with this account.", + "@codeSentEmail": { + "description": "The message that is displayed after a new confirmation code is sent via email" + }, + "codeSentSMS": "A new confirmation code has been sent to the phone number associated with this account.", + "@codeSentSMS": { + "description": "The message that is displayed after a new confirmation code is sent via SMS" + }, + "codeSentUnknown": "A new confirmation code has been sent.", + "@codeSentUnknown": { + "description": "The message that is displayed after a new confirmation code is sent via an unknown delivery medium" + } +} \ No newline at end of file diff --git a/packages/amplify_authenticator/lib/src/l10n/string_resolver.dart b/packages/amplify_authenticator/lib/src/l10n/string_resolver.dart new file mode 100644 index 0000000000..e97c7fb69d --- /dev/null +++ b/packages/amplify_authenticator/lib/src/l10n/string_resolver.dart @@ -0,0 +1,18 @@ +/* + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import 'package:flutter/widgets.dart'; + +typedef StringResolver = String Function(BuildContext context); diff --git a/packages/amplify_authenticator/lib/src/widgets/exception_banner.dart b/packages/amplify_authenticator/lib/src/widgets/authenticator_banner.dart similarity index 100% rename from packages/amplify_authenticator/lib/src/widgets/exception_banner.dart rename to packages/amplify_authenticator/lib/src/widgets/authenticator_banner.dart diff --git a/packages/amplify_authenticator/tool/generate_l10n.sh b/packages/amplify_authenticator/tool/generate_l10n.sh index 0f58586c36..a6b2c403c0 100755 --- a/packages/amplify_authenticator/tool/generate_l10n.sh +++ b/packages/amplify_authenticator/tool/generate_l10n.sh @@ -21,10 +21,10 @@ EOF ) OUTPUT_DIR=lib/src/l10n/generated -TEMPLATES=('titles_en.arb' 'buttons_en.arb' 'inputs_en.arb') -ARB_DIRS=('lib/src/l10n/src/titles' 'lib/src/l10n/src/buttons' 'lib/src/l10n/src/inputs') -OUTPUT_CLASSES=('AuthenticatorTitleLocalizations' 'AuthenticatorButtonLocalizations' 'AuthenticatorInputLocalizations') -OUTPUT_FILES=('title_localizations.dart' 'button_localizations.dart' 'input_localizations.dart') +TEMPLATES=('titles_en.arb' 'buttons_en.arb' 'inputs_en.arb' 'messages_en.arb') +ARB_DIRS=('lib/src/l10n/src/titles' 'lib/src/l10n/src/buttons' 'lib/src/l10n/src/inputs' 'lib/src/l10n/src/messages') +OUTPUT_CLASSES=('AuthenticatorTitleLocalizations' 'AuthenticatorButtonLocalizations' 'AuthenticatorInputLocalizations' 'AuthenticatorMessageLocalizations') +OUTPUT_FILES=('title_localizations.dart' 'button_localizations.dart' 'input_localizations.dart' 'message_localizations.dart') for i in "${!TEMPLATES[@]}"; do ARB_DIR=${ARB_DIRS[i]}