feat(i18n)!: rename few files + add clearer documentation
This commit is contained in:
@@ -29,36 +29,32 @@ class App extends StatelessWidget {
|
||||
static const String title = 'Wyatt i18n Example';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final I18nDataSource dataSource = NetworkDataSourceImpl(
|
||||
baseUri: Uri.parse(
|
||||
'https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/raw/commit/75f561a19e0484e67e511dbf29601ec5f58544aa/packages/wyatt_i18n/example/assets/',
|
||||
),
|
||||
);
|
||||
|
||||
final I18nRepository repository =
|
||||
I18nRepositoryImpl(dataSource: dataSource);
|
||||
|
||||
return MaterialApp(
|
||||
title: title,
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
localizationsDelegates: [
|
||||
I18nDelegate(repository: repository),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate
|
||||
],
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(title),
|
||||
Widget build(BuildContext context) => MaterialApp(
|
||||
title: title,
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
body: Builder(
|
||||
builder: (ctx) => Center(
|
||||
child: Text(ctx.i18n('youHavePushed', {'count': 654})),
|
||||
localizationsDelegates: [
|
||||
I18nDelegate(
|
||||
dataSource: NetworkI18nDataSourceImpl(
|
||||
baseUri: Uri.parse(
|
||||
'https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/raw/commit/75f561a19e0484e67e511dbf29601ec5f58544aa/packages/wyatt_i18n/example/assets/',
|
||||
),
|
||||
localeTransformer: (locale) => locale.languageCode,
|
||||
),
|
||||
),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate
|
||||
],
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(title),
|
||||
),
|
||||
body: Builder(
|
||||
builder: (ctx) => Center(
|
||||
child: Text(ctx.i18n('youHavePushed', {'count': 654})),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user