fluent_localization 1.5.0 copy "fluent_localization: ^1.5.0" to clipboard
fluent_localization: ^1.5.0 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.tr(
              'hello',
              args: {"greetings": "Hi", "name": "Developer"},
            );
            return Center(child: Text(hello));
          },
        ),
      ),
    );
  }
}
1
likes
160
points
176
downloads

Documentation

API reference

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

BSD-3-Clause (license)

Dependencies

fluent_localization_api, fluent_sdk, flutter, flutter_localizations

More

Packages that depend on fluent_localization