feat: add alot
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import '../models/app_error.dart';
|
||||
import 'app_localizations.dart';
|
||||
|
||||
extension AppLocalizationsHelpers on AppLocalizations {
|
||||
@@ -15,32 +16,37 @@ extension AppLocalizationsHelpers on AppLocalizations {
|
||||
};
|
||||
}
|
||||
|
||||
String localizedError(String? message) {
|
||||
String errorText(AppError? error) {
|
||||
return switch (error) {
|
||||
null => genericError,
|
||||
AppError.loadBar => couldNotLoadBar,
|
||||
AppError.createTab => couldNotCreateTabMessage,
|
||||
AppError.outOfStock => productOutOfStock,
|
||||
AppError.addProductToTab => couldNotAddProductToTab,
|
||||
AppError.updateQuantity => couldNotUpdateQuantity,
|
||||
AppError.closeTab => couldNotCloseTab,
|
||||
AppError.renameTab => couldNotRenameTab,
|
||||
AppError.deleteTab => couldNotDeleteTab,
|
||||
AppError.loadHistory => couldNotLoadHistory,
|
||||
AppError.loadMoreTabs => couldNotLoadMoreTabs,
|
||||
AppError.loadProducts => couldNotLoadProducts,
|
||||
AppError.addProduct => couldNotAddProduct,
|
||||
AppError.updateProduct => couldNotUpdateProduct,
|
||||
AppError.deleteProduct => couldNotDeleteProduct,
|
||||
AppError.checkPinStatus => couldNotCheckPinStatus,
|
||||
AppError.savePin => couldNotSavePin,
|
||||
AppError.incorrectPin => incorrectPin,
|
||||
AppError.verifyPin => couldNotVerifyPin,
|
||||
AppError.currentPinIncorrect => currentPinIncorrect,
|
||||
AppError.tooManyPinAttempts => tooManyPinAttempts,
|
||||
AppError.loadSettings => couldNotLoadSettings,
|
||||
AppError.saveSettings => couldNotSaveSettings,
|
||||
};
|
||||
}
|
||||
|
||||
/// Update messages still come from the OTA plugin as plain strings.
|
||||
String _updateMessage(String? message) {
|
||||
return switch (message) {
|
||||
'Could not load bar screen.' => couldNotLoadBar,
|
||||
'Could not create tab.' => couldNotCreateTabMessage,
|
||||
'Product is out of stock.' => productOutOfStock,
|
||||
'Could not add product to tab.' => couldNotAddProductToTab,
|
||||
'Could not update item quantity.' => couldNotUpdateQuantity,
|
||||
'Could not close tab.' => couldNotCloseTab,
|
||||
'Could not rename tab.' => couldNotRenameTab,
|
||||
'Could not delete tab.' => couldNotDeleteTab,
|
||||
'Could not reload tabs.' => couldNotReloadTabs,
|
||||
'Could not load tab history.' => couldNotLoadHistory,
|
||||
'Could not load more tabs.' => couldNotLoadMoreTabs,
|
||||
'Could not load products.' => couldNotLoadProducts,
|
||||
'Could not add product.' => couldNotAddProduct,
|
||||
'Could not update product.' => couldNotUpdateProduct,
|
||||
'Could not check PIN status.' => couldNotCheckPinStatus,
|
||||
'Could not save PIN.' => couldNotSavePin,
|
||||
'Incorrect PIN.' => incorrectPin,
|
||||
'Could not verify PIN.' => couldNotVerifyPin,
|
||||
'Current PIN is incorrect.' => currentPinIncorrect,
|
||||
'Could not load settings.' => couldNotLoadSettings,
|
||||
'Could not save settings.' => couldNotSaveSettings,
|
||||
'Could not load product.' => couldNotLoadProduct,
|
||||
'Could not save product.' => couldNotSaveProduct,
|
||||
'Could not delete product.' => couldNotDeleteProduct,
|
||||
'Update failed' => updateFailed,
|
||||
'Download failed' => downloadFailed,
|
||||
'Installation failed' => installationFailed,
|
||||
@@ -76,7 +82,7 @@ extension AppLocalizationsHelpers on AppLocalizations {
|
||||
}
|
||||
if (message == 'Update already in progress') return updateAlreadyInProgress;
|
||||
|
||||
return localizedError(message);
|
||||
return _updateMessage(message);
|
||||
}
|
||||
|
||||
String devAction(String? message) {
|
||||
|
||||
Reference in New Issue
Block a user