ez_localization 0.1.0 copy "ez_localization: ^0.1.0" to clipboard
ez_localization: ^0.1.0 copied to clipboard

outdated

Localize your flutter application quickly and easily.

example/lib/main.dart

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

/// First plugin test method.
void main() => runApp(_EzLocalizationDemoApp());

/// The demo material app.
class _EzLocalizationDemoApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    EzLocalizationDelegate localizationDelegate = EzLocalizationDelegate(
      supportedLocales: [
        Locale('en'),
        Locale('fr'),
        Locale('es'),
      ],
    );
    return MaterialApp(
      title: 'EzLocalization Demo',
      home: Scaffold(
        appBar: AppBar(
          title: Text('EzLocalization Demo'),
        ),
        body: _EzLocalizationDemoWidget(),
      ),
      localizationsDelegates: localizationDelegate.localizationDelegates,
      supportedLocales: localizationDelegate.supportedLocales,
      localeResolutionCallback: localizationDelegate.localeResolutionCallback,
    );
  }
}

/// The main demo widget.
class _EzLocalizationDemoWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print('If your language is set to French or Spanish, here\'s the word "Hello !" in your language :');
    print(EzLocalization.of(context).get('hello'));
    print('(Otherwise it should display a simple "Hello !".)');
    print('Oh, and here\'s an apple : ' + EzLocalization.of(context).get('fruits.apple') + '.');

    return Padding(
      padding: EdgeInsets.all(8),
      child: Center(
        child: RichText(
          text: TextSpan(
            text: 'If your language is set to French or Spanish, here\'s the word "Hello !" in your language :\n',
            children: [
              TextSpan(
                text: EzLocalization.of(context).get('hello'),
                style: Theme.of(context).textTheme.body1.copyWith(fontSize: 18, fontWeight: FontWeight.bold),
              ),
              TextSpan(text: '\n(Otherwise it should display a simple "Hello !".)\n\n'),
              TextSpan(text: 'Oh, and here\'s an apple : ' + EzLocalization.of(context).get('fruits.apple') + '.'),
            ],
            style: Theme.of(context).textTheme.body1.copyWith(fontSize: 18),
          ),
          textAlign: TextAlign.center,
        ),
      ),
    );
  }
}
23
likes
0
pub points
83%
popularity

Publisher

verified publisherskyost.eu

Localize your flutter application quickly and easily.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_localizations

More

Packages that depend on ez_localization