addContextNotes static method
Scan for ambiguous or repetitive strings and add context notes
Implementation
static Map<String, dynamic> addContextNotes(Map<String, dynamic> arbData) {
final ambiguous = {
'ok',
'yes',
'no',
'cancel',
'submit',
'save',
'edit',
'delete'
};
final updated = <String, dynamic>{};
arbData.forEach((key, value) {
updated[key] = value;
if (ambiguous.contains(key.toLowerCase()) ||
(value is String && ambiguous.contains(value.toLowerCase()))) {
updated['@$key'] = {
'description':
'Please provide context for "$key" (e.g., button label, dialog action, etc.)'
};
}
});
return updated;
}