Skip to content

Commit

Permalink
fix: generate empty class instead of throwing a plural error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tienisto committed Sep 16, 2022
1 parent 9ea5baf commit 0e4e6e0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions slang/lib/builder/builder/translation_model_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ class TranslationModelBuilder {
final childrenSplitByComma =
children.keys.expand((key) => key.split(Node.KEY_DELIMITER)).toList();

if (childrenSplitByComma.isEmpty) {
// fallback: empty node is a class by default
return _DetectionResult(_DetectionType.classType);
}

if (config.pluralAuto != PluralAuto.off) {
// check if every children is 'zero', 'one', 'two', 'few', 'many' or 'other'
final isPlural =
Expand Down

0 comments on commit 0e4e6e0

Please sign in to comment.