Closed GyulaSipos closed 2 months ago
InstructionsResolver
is not exported by the library, so it cannot be imported with
import 'package:amplify_authenticator/amplify_authenticator';
Instead, it has to be imported manually, like so:
import 'package:amplify_authenticator/src/l10n/instructions_resolver.dart';
but doing so results in the following warning:
Import of a library in the 'lib/src' directory of another package. (Documentation). Try importing a public library that exports this library, or removing the import.
Looking at lib/amplify_authenticator.dart
, it only seems to export the ButtonResolver
class, but none of the other resolver classes from the /lib/src/l10n directory.
If overriding these resolver classes is the official method to implement localizations, then amplify_authenticator
should export all of them.
As a sidenote, overriding 7 different resolver classes with hundreds of methods is not a developer-friendly way to localize a library. Is there an easier way to do this?
Hi @GyulaSipos @dJani97.
Thanks for reporting this issue. I've opened https://github.com/aws-amplify/amplify-flutter/pull/5169 to add the missing export.
All the other resolvers are already being exported. Please let us know if you are having issues importing other resolvers.
As of now, this is the recommend way to localize your app. https://ui.docs.amplify.aws/flutter/connected-components/authenticator/customization#internationalization-i18n
The fix has been merged and will be included in the next release. We will announce here when it's available.
Description
As per the I18n documentation i tried to create my own XYInstructionsResolver extends InstructionsResolver to localize the auth widget, but the IstructioinsResolver triggers "Classes can only extend other classes. Try specifying a different superclass, or removing the extends clause" error in the linter. The other Resolvers (InputResolver, MessageResolver, etc...) are recognisd and work as they should.
Categories
Steps to Reproduce
Try to extend InstructionsResolver in your main.dart to create localized messages. The class is not recognized.
Screenshots
No response
Platforms
Flutter Version
3.22.2
Amplify Flutter Version
2.2.0, but its the same in 1.6.1
Deployment Method
Custom Pipeline
Schema
No response