fluent_localization 0.0.2 copy "fluent_localization: ^0.0.2" to clipboard
fluent_localization: ^0.0.2 copied to clipboard

outdated

Package that allows you to set up and use translations in an easy and quick way

example/lib/main.dart

import 'package:fluent_localization/fluent_localization.dart';
import 'package:flutter/material.dart';

void main() async {
  await Fluent.build([
    LocalizationModule(),
  ]);
  runApp(MainApp(
    localizationApi: Fluent.get(),
  ));
}

class MainApp extends StatelessWidget {
  const MainApp({
    super.key,
    required this.localizationApi,
  });

  final LocalizationApi localizationApi;

  @override
  Widget build(BuildContext context) {
    // Define your supported locales
    final locales = [
      const Locale("es"),
      const Locale("en"),
    ];
    // Get localization delegates
    final localizationDelegates =
        localizationApi.getLocalizationDelegates(locales);

    return MaterialApp(
      localizationsDelegates: localizationDelegates,
      supportedLocales: locales,
      home: Scaffold(
        body: Builder(
          builder: (context) {
            final hello = context.tl('hello');
            return Center(
              child: Text(hello),
            );
          },
        ),
      ),
    );
  }
}
0
likes
0
points
183
downloads

Publisher

unverified uploader

Weekly Downloads

Package that allows you to set up and use translations in an easy and quick way

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ez_localization, fluent_localization_api, flutter, flutter_localizations, mocktail

More

Packages that depend on fluent_localization