i18n_plus 0.8.3 copy "i18n_plus: ^0.8.3" to clipboard
i18n_plus: ^0.8.3 copied to clipboard

unlistedoutdated

Helps you to implement different languages in your app with ease.

i18n-plus #

Features #

  • helps you to implement different languages in your app
  • set the language for the i18nTextfields with one call globally
  • provides easy and effortless live-changing of current the language
  • i18nText is as customizeable as the original Text Widget
  • checks if your languagesets are consistent

Example #

Simplified Implementation

import 'package:flutter/material.dart';
import 'package:i18n_plus/i18n.dart';
import 'package:i18n_plus/i18nMap.dart';
import 'package:i18n_plus/i18nText.dart';

main() {
  runApp(MaterialApp(home: Example()));
}

class Example extends StatefulWidget {
  Example({Key key}) : super(key: key);
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  I18NMap map = I18NMap({
    Locale('en', 'Us'): {"greeting": "Hello"},
    Locale('de', 'De'): {"greeting": "Hallo"},
    Locale('fr', 'Fr'): {"greeting": "Bonjour"}
  });
  I18N i18n = I18N();

  @override
  void initState() {
    i18n.seti18nMap(map);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Column(children: [
      Container(
          child: I18NText(
        i18nKey: "greeting",
        additionalString: " Flutter Dev!",
      )),
      DropdownButton<Locale>(
        items: i18n.allLocale().map((Locale value) {
          return new DropdownMenuItem<Locale>(
            value: value,
            child: new Text(value.toLanguageTag()),
          );
        }).toList(),
        onChanged: (value) {
          i18n.setCurrentLocale(value);
        },
      )
    ]));
  }
}
  • get all Locale
I18NMap map = I18NMap({
    Locale('en', 'Us'): {"greeting": "Hello"},
    Locale('de', 'De'): {"greeting": "Hallo"},
    Locale('fr', 'Fr'): {"greeting": "Bonjour"}
  });
I18N i18n = I18N();
i18n.seti18nMap(map);
i18n.allLocale();
  • get single String from i18n
I18NMap map = I18NMap({
    Locale('en', 'Us'): {"greeting": "Hello"},
    Locale('de', 'De'): {"greeting": "Hallo"},
    Locale('fr', 'Fr'): {"greeting": "Bonjour"}
  });
I18N i18n = I18N();
i18n.seti18nMap(map);
///first param [i18nKey]; second param [Locale] can be null 
///if you want to use current [Locale]
i18n.getI18nString("greeting", Locale('de', 'De'))

1
likes
0
pub points
0%
popularity

Publisher

verified publisherljb-dev.com

Helps you to implement different languages in your app with ease.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on i18n_plus