i18n_plus 0.8.2 i18n_plus: ^0.8.2 copied to clipboard
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 globaly!
- 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 #
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);
},
)
]));
}
}