more grammar copy updates

This commit is contained in:
ggurdin 2024-11-04 12:30:37 -05:00
parent e7e5367595
commit 4c26e4629a
No known key found for this signature in database
GPG key ID: A01CB41737CBB478
2 changed files with 11 additions and 3 deletions

View file

@ -39,13 +39,15 @@ enum MorphologicalCategories {
extension MorphologicalCategoriesExtension on MorphologicalCategories {
/// Convert enum to string
String toShortString() {
return toString().split('.').last;
return toString().split('.').last.toLowerCase();
}
/// Convert string to enum
static MorphologicalCategories? fromString(String category) {
return MorphologicalCategories.values.firstWhereOrNull(
(e) => e.toShortString() == category,
(e) =>
e.toShortString() ==
category.toLowerCase().replaceAll(RegExp(r'[,\[\]]'), ''),
);
}

View file

@ -20,7 +20,7 @@ String? getGrammarCopy({
}
final String key =
'grammarCopy${category.toUpperCase()}${lemma.replaceAll(",", "").toLowerCase()}';
'grammarCopy${category.replaceAll(RegExp(r'[,\[\]]'), '').toUpperCase()}${lemma.replaceAll(RegExp(r'[,\[\]]'), '').toLowerCase()}';
switch (key) {
case 'grammarCopyPOSsconj':
@ -81,6 +81,12 @@ String? getGrammarCopy({
return L10n.of(context)!.grammarCopyPUNCTTYPEbrck;
case 'grammarCopyNOUNTYPEart':
return L10n.of(context)!.grammarCopyNOUNTYPEart;
case 'grammarCopyNUMBERPSORsing':
return L10n.of(context)!.grammarCopyNUMBERPSORsing;
case 'grammarCopyNUMBERPSORplur':
return L10n.of(context)!.grammarCopyNUMBERPSORplur;
case 'grammarCopyNUMBERPSORdual':
return L10n.of(context)!.grammarCopyNUMBERPSORdual;
case 'grammarCopyNUMBERsing':
return L10n.of(context)!.grammarCopyNUMBERsing;
case 'grammarCopyGENDERmasc':