8fffafde47
Translations are provided in *.arb* format. Some keys have descriptions (indicated by leading @-symbol). Descriptions should not be copied into the translation itself. Currently only English is supported (app_en.arb), but German is planned. Apparently weblate merged .arb support at some time, so it would be nice to enable community translations at some point.
32 lines
840 B
Dart
32 lines
840 B
Dart
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
/*
|
|
* Tool to automatically generate english text from error
|
|
*/
|
|
String errorAsString(Map<String, dynamic> json, AppLocalizations trans) {
|
|
switch (json['data']) {
|
|
case 'notfound':
|
|
return trans.errorNotFound;
|
|
case 'wrongstate':
|
|
return trans.errorDataIncomplete;
|
|
case 'data':
|
|
return trans.errorDataInvalid;
|
|
case 'roomAdmin':
|
|
case 'right':
|
|
return trans.errorPermissions;
|
|
case 'server':
|
|
return trans.errorServer;
|
|
case 'closed':
|
|
return trans.errorUnreachable;
|
|
case 'auth':
|
|
return trans.errorAuth;
|
|
case 'ota':
|
|
return trans.errorInvalidOTA;
|
|
case 'existence':
|
|
return trans.errorUsernameUnavailable;
|
|
case 'config':
|
|
return trans.errorServerLimit;
|
|
}
|
|
|
|
return trans.errorUnknown;
|
|
}
|