i18n_extension 1.4.5 copy "i18n_extension: ^1.4.5" to clipboard
i18n_extension: ^1.4.5 copied to clipboard

outdated

Translation and Internationalization (i18n) for Flutter. Easy to use for both large and small projects. Uses Dart extensions to reduce boilerplate.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:i18n_extension/i18n_widget.dart';

import 'main.i18n.dart';
import 'my_screen.dart';

// Developed by Marcelo Glasberg (Aug 2019).
// For more info, see: https://pub.dartlang.org/packages/i18n_extension

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) => MaterialApp(
        localizationsDelegates: [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
          GlobalCupertinoLocalizations.delegate,
        ],
        supportedLocales: [
          const Locale('en', "US"),
          const Locale('pt', "BR"),
        ],
        home: I18n(
          // Usually you should not provide an initialLocale,
          // and just let it use the system locale.
          // initialLocale: Locale("pt", "BR"),
          //
          child: MyHomePage(),
        ),
      );
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("i18n Demo".i18n)),
      body: MyScreen(),
    );
  }
}
344
likes
0
pub points
96%
popularity

Publisher

verified publisherglasberg.dev

Translation and Internationalization (i18n) for Flutter. Easy to use for both large and small projects. Uses Dart extensions to reduce boilerplate.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

args, flutter, sprintf

More

Packages that depend on i18n_extension