pull/1924/head
parent
731e483d8b
commit
b5ecbd3dce
3 changed files with 40 additions and 46 deletions
@ -0,0 +1,24 @@ |
|||||||
|
// ignore_for_file: avoid_print |
||||||
|
|
||||||
|
import 'dart:io' show Directory, Process; |
||||||
|
|
||||||
|
Future<void> main(List<String> args) async { |
||||||
|
final generatedDartLocalizationsFolder = Directory('lib/src/l10n/generated'); |
||||||
|
if (await generatedDartLocalizationsFolder.exists()) { |
||||||
|
print( |
||||||
|
'Generated directory (${generatedDartLocalizationsFolder.path}) exists, deleting it... 📁', |
||||||
|
); |
||||||
|
await generatedDartLocalizationsFolder.delete(recursive: true); |
||||||
|
} |
||||||
|
print('Running flutter pub get... 📦'); |
||||||
|
await Process.run('flutter', ['pub', 'get']); |
||||||
|
|
||||||
|
print('Running flutter gen-l10n... 🌍'); |
||||||
|
await Process.run('flutter', ['gen-l10n']); |
||||||
|
|
||||||
|
print('Applying Dart fixes to the newly generated files... 🔧'); |
||||||
|
await Process.run('dart', ['fix', '--apply', './lib/src/l10n/generated']); |
||||||
|
|
||||||
|
print('Formatting the newly generated Dart files... ✨'); |
||||||
|
await Process.run('dart', ['format', './lib/src/l10n/generated']); |
||||||
|
} |
@ -1,29 +0,0 @@ |
|||||||
#!/bin/bash |
|
||||||
|
|
||||||
# Important: make sure to run the script in the root folder of the repo: |
|
||||||
# ./scripts/regenerate_translations.sh |
|
||||||
# otherwise the script could delete the wrong folder in rare cases |
|
||||||
|
|
||||||
# TODO: Refactor this to a dart script to allow developers who use Windows to use it |
|
||||||
|
|
||||||
echo "" |
|
||||||
|
|
||||||
echo "Delete the current generated localizations..." |
|
||||||
rm -rf lib/src/l10n/generated |
|
||||||
echo "" |
|
||||||
|
|
||||||
echo "Run flutter pub get.." |
|
||||||
flutter pub get |
|
||||||
echo "" |
|
||||||
|
|
||||||
echo "Run flutter gen-l10n" |
|
||||||
flutter gen-l10n |
|
||||||
echo "" |
|
||||||
|
|
||||||
echo "" |
|
||||||
echo "Apply dart fixes to the newly generated files" |
|
||||||
dart fix --apply ./lib/src/l10n/generated |
|
||||||
|
|
||||||
echo "" |
|
||||||
echo "Formate the newly generated dart files" |
|
||||||
dart format ./lib/src/l10n/generated |
|
Loading…
Reference in new issue