feat(i18n)!: rename few files + add clearer documentation

This commit is contained in:
2023-03-01 17:27:19 +01:00
parent 55ee89fb26
commit 6c7e561fde
22 changed files with 510 additions and 429 deletions
+25 -29
View File
@@ -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})),
),
),
),
),
);
}
);
}