flutter-web-admin
flutter-web-admin copied to clipboard
Generate translations
Hi, I am trying to change translation by using
dart run intl_utils:generate
I have already define l10n.yaml in root folder
arb-dir: lib/l10n
template-arb-file: intl_en.arb
output-dir: lib/generated/intl
output-localization-file: l10n.dart # Change the output file
class-name: Lang # Specify the custom class name
but unfortenately, the generated code give error, because of class-name issue in l10n.dart
class S {
S();
static S? _current;
static S get current {
assert(_current != null,
'No instance of S was loaded. Try to initialize the S delegate before accessing S.current.');
return _current!;
}
static const AppLocalizationDelegate delegate = AppLocalizationDelegate();
static Future<S> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
final instance = S();
S._current = instance;
return instance;
});
}
static S of(BuildContext context) {
final instance = S.maybeOf(context);
assert(instance != null,
'No instance of S present in the widget tree. Did you add S.delegate in localizationsDelegates?');
return instance!;
}
static S? maybeOf(BuildContext context) {
return Localizations.of<S>(context, S);
}
the class name should Lang
Could you tell me, the correct way to generate translation?