Localization
Forui supports all 115 languages that Flutter natively does.
To enable localization for Forui widgets, add the FLocalizations.delegate
in your call to the constructor for CupertinoApp
, MaterialApp
, or WidgetsApp
. Afterwards, add the locales supported by your application.
Widget build(BuildContext context) => MaterialApp(
localizationsDelegates: [
FLocalizations.delegate, // Add this line
],
supportedLocales: [
// Add locales supported by your application here.
],
builder: (context, child) => FTheme(
data: FThemes.zinc.light,
child: child!,
),
home: const FScaffold(...),
);
The FLocalizations
class also provides auto-generated localizationsDelegates
and supportedLocales
lists. You can use
these instead of providing them manually if your application doesn’t have any other localization messages.
Widget build(BuildContext context) => MaterialApp(
localizationsDelegates: FLocalizations.localizationsDelegates,
supportedLocales: FLocalizations.supportedLocales,
builder: (context, child) => FTheme(
data: FThemes.zinc.light,
child: child!,
),
home: const FScaffold(...),
);
Please see Internationalizing Flutter apps for more information.