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

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.getDelegates(locales);

    return MaterialApp(
      localizationsDelegates: localizationDelegates,
      supportedLocales: locales,
      home: Scaffold(
        body: Builder(
          builder: (context) {
            final hello = context.tl('hello', args: {
              "greetings": "Hi",
              "name": "Developer",
            });
            return Center(
              child: Text(hello),
            );
          },
        ),
      ),
    );
  }
}
0
likes
0
points
179
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

fluent_localization_api, fluent_sdk, flutter, flutter_localizations

More

Packages that depend on fluent_localization