Localizations
If you are using the flutter_localizations package, you will need access to the generated localization files inside your Widgetbook app. Here's how you can do it:
-
Change the
l10n.yamlfile by setting thesynthetic-packageoption tofalse:arb-dir: lib/l10n template-arb-file: app_en.arb output-localization-file: app_localizations.dart synthetic-package: false -
Update your
.gitignorefile to include the generated localization files:# Generated localization files lib/l10n/*.dart -
Generate the localization files by running the following command:
flutter gen-l10n -
Add the generated localization files to your Widgetbook app via the
LocalizationAddon:import 'package:your_app/l10n/app_localizations.dart'; // ... @App() class WidgetbookApp extends StatelessWidget { const WidgetbookApp({super.key}); @override Widget build(BuildContext context) { return Widgetbook( // ... addons: [ LocalizationAddon( locales: AppLocalizations.supportedLocales, localizationsDelegates: AppLocalizations.localizationsDelegates, initialLocale: AppLocalizations.supportedLocales.last, ), ], ); } }

