1
0
mirror of https://github.com/flutter/samples.git synced 2026-05-30 02:49:40 +00:00

[Gallery] Convert the Makefile to instead use the Dart workflow package Grinder. (#191)

* Replace Makefile with the Dart workflows package Grinder
This commit is contained in:
Per Classon
2019-12-19 09:17:10 +01:00
committed by GitHub
parent 5b5ceed664
commit da3412c061
8 changed files with 192 additions and 76 deletions

View File

@@ -22,18 +22,21 @@ This allows use of the English message through your localizations delegate in
the application code immediately without having to wait for the translations
to be completed.
To generate `GalleryLocalizations`, from `gallery/` run:
```
make l10n
```
## How to Generate GalleryLocalizations with Grinder
For more details on what `make l10n` runs, you can read below under Generate GalleryLocalizations.
From the `samples/gallery/gallery/` directory:
1. Make sure you have [grinder](https://pub.dev/packages/grinder) installed by
running `flutter pub get`.
2. Then run `flutter pub run grinder l10n` to generate `GalleryLocalizations`.
The current supported locales list is sorted alphabetically. So after running the script, update
`gallery_localizations.dart` to move the `en_US` locale to the top of the list.
For more details on what `flutter pub run grinder l10n` runs, you can read below
under *How to Generate GalleryLocalizations with l10n scripts*. The current
supported locales list is sorted alphabetically. This means that after running
the script, you have to update `gallery_localizations.dart` and move the `en_US`
locale to the top of the list.
## Generate GalleryLocalizations
To generate GalleryLocalizations, from `gallery/` run:
## How to Generate GalleryLocalizations with l10n scripts
To generate GalleryLocalizations, from `samples/gallery/gallery/` run:
```dart
dart ${YOUR_FLUTTER_PATH}/dev/tools/localization/bin/gen_l10n.dart \
@@ -42,9 +45,9 @@ dart ${YOUR_FLUTTER_PATH}/dev/tools/localization/bin/gen_l10n.dart \
--output-class=GalleryLocalizations
```
From `gallery/`, run `dart ../l10n_cli/bin/main.dart`, which will generate
`intl_en_US.xml`. This will be used by the internal translation console to
generate messages in the different locales.
From `samples/gallery/gallery/`, run `dart ../l10n_cli/bin/main.dart`, which
will generate `intl_en_US.xml`. This will be used by the internal translation
console to generate messages in the different locales.
Run the formatter to make the Flutter analyzer happy:
```
@@ -63,8 +66,7 @@ available, run the following commands to generate all necessary
`messages_<locale>.dart` files and the `localizations_delegate.dart` file:
```
make gen-l10n
make format
flutter pub run grinder l10n
```
which is equal to
@@ -79,9 +81,3 @@ flutter format .
```
This ensures the generated `.dart` files updated with the latest translations.
Run the formatter to make the Flutter analyzer happy:
```
flutter format .
```