2023-03-29 15:14:27 +02:00
|
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
|
2023-03-17 21:06:23 +01:00
|
|
|
/*
|
2023-03-22 21:17:03 +01:00
|
|
|
* Tool to automatically generate english text from error
|
|
|
|
*/
|
2023-03-29 15:14:27 +02:00
|
|
|
String errorAsString(Map<String, dynamic> json, AppLocalizations trans) {
|
2023-03-22 21:17:03 +01:00
|
|
|
switch (json['data']) {
|
|
|
|
case 'notfound':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorNotFound;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'wrongstate':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorDataIncomplete;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'data':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorDataInvalid;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'roomAdmin':
|
|
|
|
case 'right':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorPermissions;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'server':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorServer;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'closed':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorUnreachable;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'auth':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorAuth;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'ota':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorInvalidOTA;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'existence':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorUsernameUnavailable;
|
2023-03-22 21:17:03 +01:00
|
|
|
case 'config':
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorServerLimit;
|
2023-03-22 21:17:03 +01:00
|
|
|
}
|
2023-03-17 21:06:23 +01:00
|
|
|
|
2023-03-29 15:14:27 +02:00
|
|
|
return trans.errorUnknown;
|
2023-03-17 21:06:23 +01:00
|
|
|
}
|