Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Oct 25, 2024
1 parent 53947aa commit 6ba3fd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import '../generation_options.dart';

class ImportGeneration {
final GenerationOptions options;
final List<String> locales;
final String name;

ImportGeneration(this.options);
ImportGeneration(this.options, this.locales, this.name);

List<Directive> generate() {
final serializationImports = switch (options.deserialization) {
Expand All @@ -24,9 +26,13 @@ class ImportGeneration {
],
PluralSelectorType.custom => <Directive>[],
};

final deferredImports = locales.map((e) => Directive.importDeferredAs(
'${name}_${e}_empty.dart', '${name}_${e}_empty'));
return [
...serializationImports,
...pluralImports,
...deferredImports,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ class MethodGeneration {
if (dataFile == null) {
throw ArgumentError('Locale \$locale is not in \$knownLocales');
}
if (locale.startsWith('en')) {
await empty_en.loadLibrary();
} else if (locale.startsWith('de')) {
await empty_de.loadLibrary();
}
$loading
if (messageList.preamble.hash != info?.\$2) {
throw ArgumentError(\'\'\'
Expand Down

0 comments on commit 6ba3fd2

Please sign in to comment.