-
-
Notifications
You must be signed in to change notification settings - Fork 366
Open
Description
Thank you for the really helpful #763!
I really loved if can extend the audit command to use for verify unused translations on json file.
I experimented and maybe this is a way:
- Using
audit_command.dartbase file, modify this lines
const _preservedKeywords = [
'few',
'many',
'one',
'other',
'two',
'zero',
'male',
'female',
];
class AuditCommand {
...
final missing = keysInFile.difference(usedKeys);
final preserved = missing
.where((key) => !_preservedKeywords.any(key.contains))
.toList();
final missingWithVariables = preserved
.where((key) => key.contains('\$'))
.toList();
final missingWithoutVariables = preserved
.where((key) => !key.contains('\$'))
.toList();
...
}Need to improve to handle better the plurals, gender and also some false positives like when the key and tr isn't on same line:
Text(
context.tr(
position.nameTranslated,
gender: gender.name,
),
)
...
extension PositionExtension on Position {
String get nameTranslated {
return switch (this) {
Position.manager => 'teams.manager_staff_label',
Position.assistantManager => 'teams.assistant_manager_staff_label',
Position.goalkeeperManager => 'teams.goalkeeper_manager_staff_label',
Position.physio => 'teams.physio_staff_label',
Position.doctor => 'teams.doctor_staff_label',
Position.delegate => 'teams.delegate_staff_label',
Position.other => 'teams.other_staff_label',
};
}
}aissat
Metadata
Metadata
Assignees
Labels
No labels