This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_i18n/flutter_i18n.dart'; | |
import 'package:flutter_i18n/flutter_i18n_delegate.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Flutter I18n', | |
debugShowCheckedModeBanner: false, | |
theme: new ThemeData( | |
primarySwatch: Colors.green, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Text( | |
FlutterI18n.translate(context, "label.main", | |
Map.fromIterables(["user"], ["Flutter lover"])) | |
), | |
new Text( | |
FlutterI18n.plural(context, "clicked.times", clicked) | |
), | |
new FlatButton( | |
color: Colors.blue, | |
onPressed: () async { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyHomeState extends State<MyHomePage> { | |
Locale currentLang; | |
int clicked = 0; | |
@override | |
void initState() { | |
super.initState(); | |
new Future.delayed(Duration.zero, () async { | |
await FlutterI18n.refresh(context, new Locale('fr')); | |
setState(() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_i18n/flutter_i18n.dart'; | |
import 'package:flutter_i18n/flutter_i18n_delegate.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Test App Anglais", | |
"label": { | |
"main": "Hello {user}!" | |
}, | |
"button": { | |
"clickMe": "Click here" | |
}, | |
"toastMessage": "You clicked on button!", | |
"clicked": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install -y git-core | |
sudo apt-get install -y curl | |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
sudo npm install -g bower | |
sudo npm install -g gulp | |
sudo apt-get install -y ruby ruby-dev |